gemmellr commented on code in PR #1728:
URL: https://github.com/apache/activemq/pull/1728#discussion_r2890762869
##########
activemq-client/src/main/java/org/apache/activemq/ActiveMQSession.java:
##########
@@ -235,6 +243,20 @@ public static interface DeliveryListener {
private BlobTransferPolicy blobTransferPolicy;
private long lastDeliveredSequenceId = -2;
+ // Single-threaded executor for async send: ensures one CompletionListener
callback at a time
+ // and that callbacks are invoked in the same order as the corresponding
send calls
+ // per Jakarta Messaging 3.1 spec section 7.3.8
+ private final ExecutorService asyncSendExecutor =
Executors.newSingleThreadExecutor(
+ r -> new Thread(r, "ActiveMQ async-send"));
+
+ // Set to true on the executor thread while a CompletionListener callback
is executing.
+ // Used to detect illegal session operations (close/commit/rollback) from
within a callback.
+ static final ThreadLocal<Boolean> IN_COMPLETION_LISTENER_CALLBACK =
ThreadLocal.withInitial(() -> false);
+
+ // Set to true on the dispatch thread while a MessageListener.onMessage()
callback is executing.
+ // Used to detect illegal connection/session operations from within a
MessageListener callback.
+ static final ThreadLocal<Boolean> IN_MESSAGE_LISTENER_CALLBACK =
ThreadLocal.withInitial(() -> false);
+
Review Comment:
I could swear I selected both Threadlocals before commenting, but its only
highlighting the lower one; the comment applied to both if that wasnt already
obvious.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact