For the mentioned case the underlying code is also meaningless. I thought, that the initial question was, if I want to close some of the sessions myself, that I can ensure, that all data are sent before closing? For this problem the one option is, that everybody writes his own code and insert it on different places, the other option is, that we have a defined place (like beforeClose), where we can ensure by simple overloading the method and inserting session.write(message).join(); that all is done before the session will be closed.

Regards
Michael

Trustin Lee wrote:

beforeClose() is meaningless because we cannot guarentee that it is invoked
"before" a connection is closed, becuase a remote peer can close the
connection.

On 5/11/06, Michael Bauroth <[EMAIL PROTECTED]> wrote:


WDYT about something like additional callbacks in IoHandlerAdapter and
derived SessionHandlers called before... ? With such stuff it would be
possible to implement the underneath code in the beforeClose() method.
Does this make sense?

Regards
Michael

Trustin Lee wrote:
> IoSession.close() closes the connection even if there's more data to
write.
> If you want to flush all data before closing the connection:
>
> session.write(message).join(); // Make sure to call join() before
calling
> close()
> session.close();
>
> HTH,
> Trustin

Reply via email to