lburgazzoli commented on code in PR #14222:
URL: https://github.com/apache/camel/pull/14222#discussion_r1609537931


##########
core/camel-core-processor/src/main/java/org/apache/camel/processor/aggregate/AggregateProcessor.java:
##########
@@ -1877,4 +1882,44 @@ public int forceDiscardingOfAllGroups() {
         return total;
     }
 
+    /**
+     * Synchronization class to avoid busy-loop when waiting for exchanges to 
be processed during shutdown.
+     */
+    protected static final class WaitableInteger extends 
AbstractQueuedSynchronizer {
+
+        // await for this integer to be equal to zero
+        public void await() throws InterruptedException {
+            acquireSharedInterruptibly(1);
+        }
+
+        // decrement the integer
+        public void decrement() {
+            releaseShared(-1);
+        }
+
+        // increment the integer
+        public void increment() {
+            releaseShared(1);
+        }
+
+        // reset the integer to zero, this call won't trigger threads blocked 
on an await() call
+        public void reset() {
+            setState(0);
+        }
+
+        protected int tryAcquireShared(int acquires) {

Review Comment:
   the `acquires` parameters seems to be unused, don't know if that's expected 
but is so a small comment could help understanding why.



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

Reply via email to