You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Trustin Lee (JIRA)" <ji...@apache.org> on 2006/05/15 10:49:05 UTC

[jira] Created: (DIRMINA-215) IoFuture.Callback.CLOSE

IoFuture.Callback.CLOSE
-----------------------

         Key: DIRMINA-215
         URL: http://issues.apache.org/jira/browse/DIRMINA-215
     Project: Directory MINA
        Type: New Feature

    Reporter: Trustin Lee
 Assigned to: Trustin Lee 
    Priority: Trivial
     Fix For: 0.9.5


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) {
                future.getSession().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(IoFuture.Callback.CLOSE);

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


[jira] Updated: (DIRMINA-215) ClosingCallback which implements IoFuture.Callback

Posted by "dave irving (JIRA)" <ji...@apache.org>.
     [ 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


[jira] Updated: (DIRMINA-215) ClosingCallback which implements IoFuture.Callback

Posted by "Trustin Lee (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/DIRMINA-215?page=all ]

Trustin Lee updated DIRMINA-215:
--------------------------------

        Summary: ClosingCallback which implements IoFuture.Callback  (was: IoFuture.Callback.CLOSE)
    Description: 
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.

  was:
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) {
                future.getSession().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(IoFuture.Callback.CLOSE);

which is much better than before.
    


> 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

>
> 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


[jira] Closed: (DIRMINA-215) IoFuture.Callback.CLOSE

Posted by "Trustin Lee (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/DIRMINA-215?page=all ]
     
Trustin Lee closed DIRMINA-215:
-------------------------------

    Resolution: Fixed

Thank you for your help, Dave!

I checked in the fix.  Will close now...

> IoFuture.Callback.CLOSE
> -----------------------
>
>          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 Callback() {
>             public void operationComplete(IoFuture future) {
>                 future.getSession().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(Callback.CLOSE);
> 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


[jira] Updated: (DIRMINA-215) IoFuture.Callback.CLOSE

Posted by "Trustin Lee (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/DIRMINA-215?page=all ]

Trustin Lee updated DIRMINA-215:
--------------------------------

        Summary: IoFuture.Callback.CLOSE  (was: ClosingCallback which implements IoFuture.Callback)
    Description: 
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 Callback() {
            public void operationComplete(IoFuture future) {
                future.getSession().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(Callback.CLOSE);


which is much better than before.

  was:
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 issue got more simplified thanks to DIRMINA-217

> IoFuture.Callback.CLOSE
> -----------------------
>
>          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 Callback() {
>             public void operationComplete(IoFuture future) {
>                 future.getSession().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(Callback.CLOSE);
> 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