franz1981 commented on a change in pull request #44:
URL: https://github.com/apache/qpid-jms/pull/44#discussion_r737491913
##########
File path: qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsSession.java
##########
@@ -194,6 +193,42 @@ public void onPendingFailure(ProviderException cause) {
}
}
+ private void processCompletions() {
+ do {
+ if (!completionThread.compareAndSet(null, Thread.currentThread()))
{
+ return;
+ }
+ try {
+ Runnable completionTask;
+ while ((completionTask = completionTasks.poll()) != null) {
+ try {
+ completionTask.run();
+ } catch (Throwable t) {
+ LOG.debug("errored on processCompletions duty cycle",
t);
+ }
+ }
+ } finally {
+ completionThread.set(null);
+ }
+ } while (!completionTasks.isEmpty());
Review comment:
isEmpty is safe to be called by many threads and ensure that a
subsequent (single threaded) poll won't return null in case `false` (we have a
good coverage for this on JCTools)
--
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]