On 7/3/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>> OK. Once close() is called on BaseIoSession, its state switches to
>> 'closing'.
>>
>> In this state, calling write() leads to calling
>> WriteFuture.newNotWrittenFuture() which returns a 'fake' WriteFuture
>> without enqueuing the request.
>>
>> So, you cannot write message to a closing session.
>
>
> I thought we can write a message in filterClose() by doing like this:
>
> void filterClose(...) {
> WriteFuture future = next.filterWrite(...);
> future.setCallback(new IoFuture.Callback() {
> public void operationComplete(...) {
> future.getSession().close();
> }
> });
> }
>
> If this doesn't work, this is a bug.
>
> HTH,
> Trustin
This works. I was calling session.write().
BTW. When sending messages from my filter, filterWrite of this filter
is called.
When closing session from my filter, filterClose is not called. Is it
normal?
It should be called later when the returned writefuture notifies the
callback. As you see, there's a call to IoSession.close() in
operationComplete() method implementation above. So, the bottom line is
that it should be called later, but not immediately. If not, it's a bug,
too. :)
HTH,
Trustin
--
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP key fingerprints:
* E167 E6AF E73A CBCE EE41 4A29 544D DE48 FE95 4E7E
* B693 628E 6047 4F8F CFA4 455E 1C62 A7DC 0255 ECA6