this.transactionContextManager = transactionContextManager;
this.repeatCount = repeatCount;
}
public void run() {
TransactionContext transactionContext = null;
for (int tries = 0; tries < repeatCount; tries++) {
try {
transactionContext = transactionContextManager.newContainerTransactionContext();
} catch (Exception e) {
log.warn("Exception occured while starting container transaction", e);
break;
}
try {
try {
userTask.run();
} catch (Exception e) {
log.warn("Exception occured while running user task", e);
}
try {
threadPooledTimer.workPerformed(workInfo);
} catch (PersistenceException e) {
log.warn("Exception occured while updating timer persistent state", e);
}
} finally {
try {
transactionContextManager.setContext(null);
if (transactionContext.commit()) {
if (workInfo.isOneTime()) {
threadPooledTimer.removeWorkInfo(workInfo);
}
// todo this is a very weird code structure.... returning from a finally is very confusing
return;