use of com.accenture.trac.common.exception.ECacheTicket in project tracdap by finos.
the class LocalJobCache method deleteJob.
@Override
public void deleteJob(String jobKey, Ticket ticket) {
var operationTime = Instant.now();
var cacheEntry = cache.computeIfPresent(jobKey, (key, priorEntry) -> {
if (priorEntry.ticket != ticket)
return priorEntry;
if (priorEntry.jobState == null)
throw new EUnexpected();
var newEntry = priorEntry.clone();
newEntry.jobState = null;
newEntry.lastActivity = operationTime;
newEntry.revision = priorEntry.revision + 1;
return newEntry;
});
if (cacheEntry != null && cacheEntry.ticket != ticket)
// TODO: Error
throw new ECacheTicket("");
}
use of com.accenture.trac.common.exception.ECacheTicket in project tracdap by finos.
the class LocalJobCache method updateJob.
@Override
public void updateJob(String jobKey, JobState jobState, Ticket ticket) {
var operationTime = Instant.now();
var cacheEntry = cache.computeIfPresent(jobKey, (key, priorEntry) -> {
if (priorEntry.ticket != ticket)
return priorEntry;
if (priorEntry.jobState == null)
// TODO: error
throw new ECacheNotFound("");
var newEntry = priorEntry.clone();
newEntry.jobState = jobState;
newEntry.lastActivity = operationTime;
newEntry.revision = priorEntry.revision + 1;
return newEntry;
});
if (cacheEntry == null || cacheEntry.ticket != ticket)
// TODO: Error
throw new ECacheTicket("");
}
use of com.accenture.trac.common.exception.ECacheTicket in project tracdap by finos.
the class LocalJobCache method createJob.
@Override
public void createJob(String jobKey, JobState jobState, Ticket ticket) {
var operationTime = Instant.now();
var cacheEntry = cache.computeIfPresent(jobKey, (key, priorEntry) -> {
if (priorEntry.ticket != ticket)
return priorEntry;
// Same job created twice, this is an unexpected logic error
if (priorEntry.jobState != null)
throw new EUnexpected();
var newEntry = priorEntry.clone();
newEntry.jobState = jobState;
newEntry.lastActivity = operationTime;
newEntry.revision = priorEntry.revision + 1;
return newEntry;
});
if (cacheEntry == null || cacheEntry.ticket != ticket)
// TODO: Error
throw new ECacheTicket("");
}
Aggregations