allthingssecurity commented on PR #28537:
URL: https://github.com/apache/camel/pull/28537#issuecomment-6436333762

   @davsclaus thanks. Both done in f6bd895c0a1b (a new commit on top).
   
   **In-flight async calls:** implemented as you suggested. `ThriftProducer` 
keeps the callback of each asynchronous call that has not completed in a 
concurrent set. The callback is removed when the call completes, or right away 
when the call cannot be made (the invocation throws). `doStop` fails the 
remaining ones with a `CamelExchangeException` ("The Thrift producer was 
stopped before the call of method ... completed") before it stops the manager. 
Each callback completes its exchange once, guarded by an `AtomicBoolean`, so a 
call that completes or errors on the selector thread while the producer stops 
is not completed twice. Side note: a `TAsyncClient` runs one call at a time 
("Client is currently executing another method"), so in practice the set holds 
at most one callback.
   
   New `ThriftProducerAsyncInFlightStopTest`, with no sleeps. A plain 
`ServerSocket` reads the request and never answers, and the test waits on a 
latch until the first request byte arrives. It then stops the producer and 
expects the exchange to complete (latch) with that exception, and the set to be 
empty. Without the loop in `doStop` it fails with `the exchange of the call 
must complete ==> expected: <true> but was: <false>` after the 10 s wait. A 
control checks that a call that completed (with an error, since nothing 
listens) is not kept.
   
   **Nit:** the 5-argument `ThriftUtils.constructAsyncClientInstance` is 
`@Deprecated(since = "4.24.0")`. Its Javadoc says it creates a manager the 
caller cannot stop and points to the overload with a `TAsyncClientManager`.
   
   **JIRA component:** I checked, and the CAMEL JIRA project has no 
camel-thrift component to select, so I left the component empty on CAMEL-26050.
   
   camel-thrift unit tests: 58 run, 0 failures. The formatter and import sort 
made no changes. I updated the description to match.
   
   _Claude Code on behalf of allthingssecurity_
   


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