long initTime = System.nanoTime();
long commit_start = 0L;
long endInQueueTime = 0L;
TpccTransaction transaction;
boolean isReadOnly = false;
boolean successful = true;
while (delta < (this.simulTime * 1000000000L)) {
isReadOnly = false;
successful = true;
transaction = null;
long start = System.nanoTime();
if (arrivalRate != 0.0) { //Open system
try {
RequestType request = queue.take();
endInQueueTime = System.nanoTime();
if (request.transactionType == TpccTerminal.NEW_ORDER) {
numWriteDequeued++;
numNewOrderDequeued++;
writeInQueueTime += endInQueueTime - request.timestamp;
newOrderInQueueTime += endInQueueTime - request.timestamp;
transaction = new NewOrderTransaction();
} else if (request.transactionType == TpccTerminal.PAYMENT) {
numWriteDequeued++;
numPaymentDequeued++;
writeInQueueTime += endInQueueTime - request.timestamp;
paymentInQueueTime += endInQueueTime - request.timestamp;
transaction = new PaymentTransaction(nodeIndex);
} else if (request.transactionType == TpccTerminal.ORDER_STATUS) {
numReadDequeued++;
readInQueueTime += endInQueueTime - request.timestamp;
transaction = new OrderStatusTransaction();
}
} catch (InterruptedException ir) {
log.error("»»»»»»»THREAD INTERRUPTED WHILE TRYING GETTING AN OBJECT FROM THE QUEUE«««««««");
}
} else {
transaction = terminal.choiceTransaction();
}
isReadOnly = transaction.isReadOnly();
Transactional.Transaction tx = transactional.getTransaction();
BasicOperations.Cache cache = tx.wrap(basicOperations.getCache(null));
long startService = System.nanoTime();
tx.begin();
try {
transaction.executeTransaction(cache);
} catch (Throwable e) {
successful = false;
log.warn("Transaction failed:", e);
if (e instanceof ElementNotFoundException) {
this.appFailures++;