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

   @davsclaus thanks. Both done in 3e4466f9a37a (a new commit on top).
   
   **Release in a finally:** `doStop` now runs the disconnect or unbind in a 
`try`, and the release in its `finally`: the connector (client mode) or 
acceptor is disposed, the worker pool is shut down and `released` is set, also 
when the unbind throws. So a later start builds a new acceptor instead of 
binding the old one again. I moved `connector.dispose(true)` of client mode 
into the same `finally`, so a failing `closeNow()` doesn't keep the connector 
either. The exception still propagates, so the stop fails as before.
   
   New test `theAcceptorIsReleasedWhenTheUnbindFails` in 
`MinaConsumerRestartTest`, with no sleeps. The tcp acceptor sits behind a 
Mockito mock that passes every call on to it, except `unbind(SocketAddress)`, 
which throws. `consumer.stop()` throws that exception, the real acceptor is 
disposed and its worker pool shut down, and then `consumer.start()` gets a new 
acceptor that receives a message. With the release after the unbind (the 
previous commit) it fails with `the acceptor of a stopped consumer must be 
disposed ==> expected: <true> but was: <false>`.
   
   **setAcceptor:** I added Javadoc saying that the consumer owns an acceptor 
set from outside. It disposes it when it stops, and a start after a stop 
creates a new acceptor from the configuration instead of binding that one again.
   
   camel-mina unit tests: 123 run, 0 failures, 4 skipped. 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