0

Is there any way to guarantee that no messages are received after the connection close event is received for TCP connections?

As it is (v. 4.1.0) , it is necesarry to implement a work around that waits a little while, before actually handling the closed connection internally in the handler.

1 Answer 1

1

Not if you are using NIO - by definition, it is designed to be multi-threaded and there is a race condition in that the last message (or messages) might be in the process of being sent on one thread when the close event is sent on another. The window is generally small, however, but certainly non-zero.

When not using NIO, as long as you don't have any async processing downstream (thread handoffs), you will not received any messages after the event since it's published on the same thread that sends messages.

Generally, NIO is not needed for a small number of connections (and not using it might even perform better). It is generally needed if you are handling lots of connections.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.