use of com.axway.ats.log.autodb.LoadQueuesState in project ats-framework by Axway.
the class DbEventRequestProcessor method registerThreadWithLoadQueue.
private void registerThreadWithLoadQueue(RegisterThreadWithLoadQueueEvent registerThreadWithLoadQueueEvent) throws NoSuchLoadQueueException, ThreadAlreadyRegisteredWithLoadQueueException, ThreadNotRegisteredWithLoadQueue {
LoadQueuesState loadQueuesState = eventProcessorState.getLoadQueuesState();
String loadQueueName = registerThreadWithLoadQueueEvent.getLoadQueueName();
// register the thread with the load queue - this way when a checkpoint comes in, we will
// now which load queue it belongs to
loadQueuesState.registerThreadWithLoadQueue(registerThreadWithLoadQueueEvent.getThreadName(), loadQueuesState.getLoadQueueId(loadQueueName));
}
use of com.axway.ats.log.autodb.LoadQueuesState in project ats-framework by Axway.
the class DbEventRequestProcessor method rememberLoadQueueState.
private void rememberLoadQueueState(RememberLoadQueueStateEvent startLoadQueueEvent) throws LoadQueueAlreadyStartedException {
// first check if this load queue has already been started, just in case
LoadQueuesState loadQueuesState = eventProcessorState.getLoadQueuesState();
String loadQueueName = startLoadQueueEvent.getName();
if (loadQueuesState.isLoadQueueRunning(loadQueueName)) {
throw new LoadQueueAlreadyStartedException(loadQueueName);
}
// cache the load queue id
loadQueuesState.addLoadQueue(loadQueueName, startLoadQueueEvent.getLoadQueueId());
}
use of com.axway.ats.log.autodb.LoadQueuesState in project ats-framework by Axway.
the class DbEventRequestProcessor method endLoadQueue.
private void endLoadQueue(EndLoadQueueEvent endLoadQueueEvent, long timestamp) throws NoSuchLoadQueueException, DatabaseAccessException {
// first check if this load queue is started at all
LoadQueuesState loadQueuesState = eventProcessorState.getLoadQueuesState();
String loadQueueName = endLoadQueueEvent.getName();
int loadQueueId = loadQueuesState.getLoadQueueId(loadQueueName);
if (loadQueueId > 0) {
try {
dbAccess.endLoadQueue(endLoadQueueEvent.getResult().toInt(), timestamp, loadQueueId, true);
} finally {
// even when this DB entity could not finish due to error,
// we want to clear the internal state,
// so next sub-entities do not go into this one
loadQueuesState.removeLoadQueue(loadQueueName, loadQueueId);
}
}
}
use of com.axway.ats.log.autodb.LoadQueuesState in project ats-framework by Axway.
the class DbEventRequestProcessor method cleanupLoadQueueState.
private void cleanupLoadQueueState(CleanupLoadQueueStateEvent loadQueueStateEvent) throws NoSuchLoadQueueException {
// first check if this load queue is started at all
LoadQueuesState loadQueuesState = eventProcessorState.getLoadQueuesState();
String loadQueueName = loadQueueStateEvent.getName();
int loadQueueId = loadQueuesState.getLoadQueueId(loadQueueName);
loadQueuesState.removeLoadQueue(loadQueueName, loadQueueId);
}
use of com.axway.ats.log.autodb.LoadQueuesState in project ats-framework by Axway.
the class DbEventRequestProcessor method endCheckpoint.
private void endCheckpoint(EndCheckpointEvent endCheckpointEvent) throws LoggingException {
// check if checkpoints are enabled at all
if (appenderConfig.getEnableCheckpoints()) {
LoadQueuesState loadQueuesState = eventProcessorState.getLoadQueuesState();
CheckpointInfo runningCheckpointInfo = loadQueuesState.endCheckpoint(endCheckpointEvent.getThread(), endCheckpointEvent.getName(), endCheckpointEvent.getEndTimestamp());
final int testcaseId = eventProcessorState.getTestCaseId();
if (!deletedTestcases.contains(testcaseId)) {
try {
dbAccess.endCheckpoint(runningCheckpointInfo, endCheckpointEvent.getEndTimestamp(), endCheckpointEvent.getTransferSize(), endCheckpointEvent.getResult().toInt(), true);
} catch (LoggingException e) {
handleDeletedTestcase(e, testcaseId);
}
}
}
}
Aggregations