I have a scenario where I need to keep writing to a Channel. In case it is unable to take further data ( because of the buffers being full etc ) , I need to stop writing , but need to resume as soon as the channel becomes writable again. How do I determine this instant when a channel becomes writable again ? Is there a callback event that is fired which I can override ? I am extending SimpleChannelUpstreamHandler in my business handler – this has a method channelInterestChanged() – but not sure if this is correct hook to tap into ?
I was hoping to avoid using primitive thread-based wait mechanisms like wait-notify as these will involve context switching. Any non-blocking way to achieve this wait ?
You can override the
channelInterestChanged()method.Something like that:
This should do the job