iga
iga

Reputation: 3633

Does Netty always close channel if unable to send a message

I am using Netty 4.1. Let's say I have an active netty channel (TCP or SSL) and I write a message to it. The message goes through all of my handlers without a problem. If netty is unable to send this message for any reason, am I guaranteed that the channel will be closed (and close future listener invoked)?

I am trying to see if I can avoid registering a listener for every write and use the voidPromise() optimization:

nettyChannel.writeAndFlush(message, nettyChannel.voidPromise());

Upvotes: 1

Views: 343

Answers (1)

Norman Maurer
Norman Maurer

Reputation: 23567

No it will not. That said if an IOException is thrown from the Socket it will close the Channel.

Upvotes: 2

Related Questions