We would like get tcp flow control as a primary component of a new java nio library. It would work like this...
BIG NOTE: Step 2 is where tcp flow control automatically kicks in IF you do not read from the nic buffer. This is all automatic (and we tested it with java nio). The issue though is how do we put the key in a state that the poller STOPS releasing and waits for data on all OTHER sockets except this one. I don't mind if it releases when it has new data as we would see that the last dataChunk has not been processed and ignore it, but we don't want the poller thread cycling 100% cpu. Is there a way to achieve this so we can acheive automatic throttling for any server using this potential open source nio framework.
Just cancel it and re-register the channel later, or just de-register it for OP_READ,
by changing its interestOps()
, and change them back when you are ready to read from it again.