I have a Netty Server (3.6.2) that generates some data and broadcast to subscribed clients. Sometimes some clients seem to don’t get the data because the client is broken or the network resources are in poor condition. In this case the server fills the Channel write queue and keeps generating events and eventually this could lead to an OutOfMemoryError.
One solution could be check if the channel isWritable() before writing and don’t write in negative case (anyway I have to store this messages or I’ll lose them). But I’d rather disconnect clients that are not flushing the write buffer in some time or at the pace I’m generating the broadcast events.
How could I do that? How could implement this write buffer is not being flushed “timeout”? Should I close clients if isWritable is false?
I’d really appreciate any ideas.
Thank you.
Yeah you could close the connection if Channel.isWritable() returns false.