Details
-
Bug
-
Resolution: Done
-
Major
-
None
-
None
-
None
-
Medium
Description
boolean started = ModelerCore.startTxn(false, false, "Some task", this); boolean succeeded = false; try { // do something useful here // This succeeded is not always set to true succeeded = true; } catch (final Exception err) { // log the exception } finally { if (started) { if (succeeded) { ModelerCore.commitTxn(); } else { ModelerCore.rollbackTxn(); } } }
There are around 300+ instances of the call to startTxn and not all set succeeded to true.
- Better to fix this by creating a transaction callback interface that anonymous classes can implement to wrap the work.
- The succeeded flag is handled internally by the transaction framework.
- All transactions handled in the same way and the succeeded flag dealt with uniformly.