gtully commented on code in PR #5595: URL: https://github.com/apache/activemq-artemis/pull/5595#discussion_r2027413792
########## artemis-server/src/main/java/org/apache/activemq/artemis/core/transaction/impl/TransactionImpl.java: ########## @@ -340,16 +346,98 @@ public void done() { } } - protected void doCommit() throws Exception { - if (containsPersistent || xid != null && state == State.PREPARED) { - // ^^ These are the scenarios where we require a storage.commit - // for anything else we won't use the journal + + // This runnable will call the parentContext + abstract class DelayedRunnable implements Runnable { + + OperationContext parentContext; + OperationContext delayedContext; + long id; + + DelayedRunnable(long id) { + parentContext = storageManager.getContext(); + parentContext.storeLineUp(); + delayedContext = storageManager.newSingleThreadContext(); + this.id = id; + } + + protected abstract void actualRun() throws Exception; + + + @Override + public void run() { + OperationContext oldContext = storageManager.getContext(); + try { + storageManager.setContext(delayedContext); + actualRun(); + delayedContext.executeOnCompletion(new IOCallback() { + @Override + public void done() { + parentContext.done(); + } + + @Override + public void onError(int errorCode, String errorMessage) { + parentContext.onError(errorCode, errorMessage); Review Comment: should old context get an onError callback here too, or when would there be a parent and an old and a delayed context, ie: 3? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: gitbox-unsubscr...@activemq.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: gitbox-unsubscr...@activemq.apache.org For additional commands, e-mail: gitbox-h...@activemq.apache.org For further information, visit: https://activemq.apache.org/contact