allthingssecurity commented on code in PR #30759:
URL: https://github.com/apache/camel/pull/30759#discussion_r4692478655


##########
core/camel-api/src/main/java/org/apache/camel/ExchangeExtension.java:
##########
@@ -143,6 +143,13 @@ default void setSharedUnitOfWork(@Nullable UnitOfWork 
unitOfWork) {
      */
     void setInterrupted(boolean interrupted);
 
+    /**
+     * Used by the {@link org.apache.camel.spi.AsyncProcessorAwaitManager} 
each time a thread calls it to wait for this
+     * exchange: returns a number one higher than the previous call for this 
exchange, so the manager knows which of the
+     * threads that wait for the exchange called it last. This is used 
internally by Camel.
+     */
+    long nextAwaitOrder();

Review Comment:
   Done in fdd53b07cc: added `@since 4.24` and a note that the calls for one 
exchange do not overlap (the inner call comes after the exchange was handed to 
another thread, and that hand-off orders the two calls), so a plain counter is 
safe. I kept the plain field rather than an `AtomicLong` to stay off the hot 
path.



##########
core/camel-api/src/main/java/org/apache/camel/spi/AsyncProcessorAwaitManager.java:
##########
@@ -176,6 +179,14 @@ default String getNodeSource() {
      * Though if it appears as the exchange is <i>stuck</i>, then this method 
can remedy this, by forcing the latch to
      * count-down so the blocked thread can continue. An exception is set on 
the exchange which allows Camel's error
      * handler to deal with this malfunctioned exchange.
+     * <p>
+     * When more than one thread waits for the exchange, only the thread whose
+     * {@link #process(AsyncProcessor, Exchange)} call started last is 
released. This is a nested wait: a thread waits

Review Comment:
   Done in fdd53b07cc: split into shorter sentences.



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