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


##########
core/camel-core-processor/src/main/java/org/apache/camel/processor/resequencer/ResequencerEngine.java:
##########
@@ -110,6 +120,30 @@ public synchronized int size() {
         return sequence.size();
     }
 
+    public void waitUntil(Predicate<Sequence<?>> pred) throws 
InterruptedException {
+        CountDownLatch latch;
+        synchronized (this) {

Review Comment:
   _nitpick_
   
   I don't know how exactly this class is used so this may no be an issue, but 
it is usually a good idea not to synchronize on the instance as you may get 
some side effects (got bitten in the past, so I noticed it), like the following 
code would end up in a deadlock:
   
   ```java
    var re = enw ResequencerEngine<>()
    syncrronized(re) {
        re.waitUntil(s -> { ... })
    }
    ```



-- 
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: commits-unsubscr...@camel.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to