[ http://issues.apache.org/jira/browse/DIRMINA-215?page=all ]

dave irving updated DIRMINA-215:
--------------------------------

    Attachment: DIRMINA-215.patch

HTH

> ClosingCallback which implements IoFuture.Callback
> --------------------------------------------------
>
>          Key: DIRMINA-215
>          URL: http://issues.apache.org/jira/browse/DIRMINA-215
>      Project: Directory MINA
>         Type: New Feature

>     Reporter: Trustin Lee
>     Assignee: Trustin Lee
>     Priority: Trivial
>      Fix For: 0.9.5
>  Attachments: DIRMINA-215.patch
>
> When you want to close the connection when the last message is sent, you 
> usually choose one of two approaches:
> 1) session.write(message).join();
>     session.close();
> 2) session.write(message).setCallback(new IoFuture.Callback() {
>             public void operationComplete(IoFuture future) {
>                 session.close();
>             });
> The first approach is very good from the viewpoint of simplicity, but it 
> won't work in a single thread mode.  The second one works in a single thread 
> mode, but it's very verbose.  To relax the code complexity of the approach 2, 
> it would be nice if we have a predefined Callback for closing a session.  The 
> new code will be:
> 2) session.write(message).setCallback(new ClosingCallback(session));
> which is much better than before.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to