users@grizzly.java.net

Re: async writes via 2 protocol chains on one controller

From: Radim Kolar SF.NET <hsn_at_sendmail.cz>
Date: Sat, 27 Oct 2007 16:04:22 +0200

> Right now the Context is associated with the SelectionKey. What you means
> is doing something like key.attach(context), the register the key and
> re-use the Context from that key?
i am not sure, but i think that now every select() loop different context
is fetched from cache attached to SelectionKey, they are not 1:1 mapped.
using key.attach by framework itself of course should be avoided.

>> 3. In filter reader chain just alter protocol state in context or write
>> raw data into context write buffer) and switch SelectionKey on Selector
>> from OP_READ to OP_WRITE and return false; (don't call next filter in read
>> chain).
> Should this can be done in another filter instead?
yes think about coding echo like:
op_read: ReadFilter SwitchToWriteFilter
op_write: WriteFilter SwitchToReadFilter