franz1981 commented on pull request #44:
URL: https://github.com/apache/qpid-jms/pull/44#issuecomment-957261604


   I see that a version that just handle one completion task at time to 
guarantee FJ to handle fairness of completions isn't working that bad, really, 
but I need to perform some more tests on it, code-wise it means:
   ```java
       private void processCompletions() {
           assert processCompletion.get();
           completionThread = Thread.currentThread();
           try {
               final Runnable completionTask = completionTasks.poll();
               if (completionTask != null) {
                   try {
                       completionTask.run();
                   } catch (Throwable t) {
                       LOG.debug("errored on processCompletions duty cycle", t);
                   }
               }
           } finally {
               completionThread = null;
               processCompletion.set(false);
           }
           if (completionTasks.isEmpty()) {
               return;
           }
           // a racing asyncProcessCompletion has won: no need to fire a 
continuation
           if (!processCompletion.compareAndSet(false, true)) {
               return;
           }
           getCompletionExecutor().execute(this::processCompletions);
       }
   ```
   


-- 
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]

Reply via email to