You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Hooman Valibeigi (JIRA)" <ji...@apache.org> on 2006/09/20 11:00:22 UTC

[jira] Created: (DIRMINA-269) stop SocketConnector.connect()

stop SocketConnector.connect()
------------------------------

                 Key: DIRMINA-269
                 URL: http://issues.apache.org/jira/browse/DIRMINA-269
             Project: Directory MINA
          Issue Type: Improvement
    Affects Versions: 0.9.5
            Reporter: Hooman Valibeigi


Currently I'm using the following logic to connect to server

ConnectFuture future = socket.connect(SocketAddress, IoHandler);
future.join();
try {
    session = future.getSession();
} catch (Exception e) {
    // e.getCause() tells the error
}

it waits till the connection is established. but I want the user to be able to stop the connect process while it is not yet established. for example in cases that Connection_Timeout would occur, the user should wait till the time out is finished. is it possible to stop it whenever we desire?

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

        

Re: [jira] Commented: (DIRMINA-269) stop SocketConnector.connect()

Posted by Trustin Lee <tr...@gmail.com>.
On 9/14/07, UI Implementor <ad...@hotmail.com> wrote:
>
> Tristan,

Trustin :)

> I'm in agreement with the original poster -- in fact, I found this
> conversation by searching for "mina connect cancel", because I wanted to
> know how to programmatically cancel a connection without waiting for a
> timeout.  Being able to cancel at will turns out to be extremely useful when
> building a client with a user interface.  For example, when you use a
> browser and you type the wrong address, you can always hit the "stop" button
> and try something else.  Or if it's taking a while to connect and you're not
> willing to wait for the timeout, since you have good reason to believe that
> the site may be down, you hit "stop".  I'd like to provide the same feature
> in my user interface.  I can do it, in a sense, by telling the user that the
> connection has been canceled, while maintaining my own separate thread
> waiting for the connection to be completed; when it's completed, I can then
> immediately kill it.  But it's a shame I can't just kill the connection
> attempt immediately and be done with it at that point.  If the user doesn't
> want the connection anymore, he or she should be able to kill it.
>
> In summary, a cancel() method in ConnectFuture would be a huge help.

I agree with you.  cancel() had to exist from the day 0.

> Thanks!  MINA is really a great project; it's made a big difference in my
> productivity.

Glad to hear that!  We also appreciate your feed back, which will
improve MINA one step forward.

Thanks,
Trustin
-- 
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP Key ID: 0x0255ECA6

Re: [jira] Commented: (DIRMINA-269) stop SocketConnector.connect()

Posted by UI Implementor <ad...@hotmail.com>.
Tristan,

I'm in agreement with the original poster -- in fact, I found this
conversation by searching for "mina connect cancel", because I wanted to
know how to programmatically cancel a connection without waiting for a
timeout.  Being able to cancel at will turns out to be extremely useful when
building a client with a user interface.  For example, when you use a
browser and you type the wrong address, you can always hit the "stop" button
and try something else.  Or if it's taking a while to connect and you're not
willing to wait for the timeout, since you have good reason to believe that
the site may be down, you hit "stop".  I'd like to provide the same feature
in my user interface.  I can do it, in a sense, by telling the user that the
connection has been canceled, while maintaining my own separate thread
waiting for the connection to be completed; when it's completed, I can then
immediately kill it.  But it's a shame I can't just kill the connection
attempt immediately and be done with it at that point.  If the user doesn't
want the connection anymore, he or she should be able to kill it.

In summary, a cancel() method in ConnectFuture would be a huge help.

Thanks!  MINA is really a great project; it's made a big difference in my
productivity.



JIRA jira@apache.org wrote:
> 
>     [
> http://issues.apache.org/jira/browse/DIRMINA-269?page=comments#action_12436256
> ] 
>             
> Hooman Valibeigi commented on DIRMINA-269:
> ------------------------------------------
> 
> Setting timeout is not the what I need
> I want to be able to cancel the connection before timeout is over
> For example by calling future.cancel()
> The client user may have entered some wrong host names and soon he wants
> to cancel the current connection to enter another one, instead of waiting
> N seconds till the connection is timed out
> 
>> stop SocketConnector.connect()
>> ------------------------------
>>
>>                 Key: DIRMINA-269
>>                 URL: http://issues.apache.org/jira/browse/DIRMINA-269
>>             Project: Directory MINA
>>          Issue Type: Improvement
>>    Affects Versions: 0.9.5
>>            Reporter: Hooman Valibeigi
>>         Assigned To: Trustin Lee
>>
>> Currently I'm using the following logic to connect to server
>> ConnectFuture future = socket.connect(SocketAddress, IoHandler);
>> future.join();
>> try {
>>     session = future.getSession();
>> } catch (Exception e) {
>>     // e.getCause() tells the error
>> }
>> it waits till the connection is established. but I want the user to be
>> able to stop the connect process while it is not yet established. for
>> example in cases that Connection_Timeout would occur, the user should
>> wait till the time out is finished. is it possible to stop it whenever we
>> desire?
> 
> -- 
> 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
> 
>         
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/-jira--Created%3A-%28DIRMINA-269%29-stop-SocketConnector.connect%28%29-tf2697389s16868.html#a12657147
Sent from the Apache MINA Support Forum mailing list archive at Nabble.com.


Re: [jira] Commented: (DIRMINA-269) stop SocketConnector.connect()

Posted by kanful <cz...@163.com>.
I also want to know how to shutdown client at once;
-- 
View this message in context: http://www.nabble.com/-jira--Created%3A-%28DIRMINA-269%29-stop-SocketConnector.connect%28%29-tf2697389s16868.html#a12590170
Sent from the Apache MINA Support Forum mailing list archive at Nabble.com.


[jira] Commented: (DIRMINA-269) stop SocketConnector.connect()

Posted by "Hooman Valibeigi (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/DIRMINA-269?page=comments#action_12436256 ] 
            
Hooman Valibeigi commented on DIRMINA-269:
------------------------------------------

Setting timeout is not the what I need
I want to be able to cancel the connection before timeout is over
For example by calling future.cancel()
The client user may have entered some wrong host names and soon he wants to cancel the current connection to enter another one, instead of waiting N seconds till the connection is timed out

> stop SocketConnector.connect()
> ------------------------------
>
>                 Key: DIRMINA-269
>                 URL: http://issues.apache.org/jira/browse/DIRMINA-269
>             Project: Directory MINA
>          Issue Type: Improvement
>    Affects Versions: 0.9.5
>            Reporter: Hooman Valibeigi
>         Assigned To: Trustin Lee
>
> Currently I'm using the following logic to connect to server
> ConnectFuture future = socket.connect(SocketAddress, IoHandler);
> future.join();
> try {
>     session = future.getSession();
> } catch (Exception e) {
>     // e.getCause() tells the error
> }
> it waits till the connection is established. but I want the user to be able to stop the connect process while it is not yet established. for example in cases that Connection_Timeout would occur, the user should wait till the time out is finished. is it possible to stop it whenever we desire?

-- 
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] Resolved: (DIRMINA-269) stop SocketConnector.connect()

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

Trustin Lee resolved DIRMINA-269.
---------------------------------

    Resolution: Invalid
      Assignee: Trustin Lee

There's already connection timeout setting.

SocketConnectorConfig cfg = new SocketConnectorConfig();
cfg.setConnectTimeout( 10 ); // 10 seconds

connector.bind( address, handler, cfg );

Please reopen this issue if this setting doesn't work.


> stop SocketConnector.connect()
> ------------------------------
>
>                 Key: DIRMINA-269
>                 URL: http://issues.apache.org/jira/browse/DIRMINA-269
>             Project: Directory MINA
>          Issue Type: Improvement
>    Affects Versions: 0.9.5
>            Reporter: Hooman Valibeigi
>         Assigned To: Trustin Lee
>
> Currently I'm using the following logic to connect to server
> ConnectFuture future = socket.connect(SocketAddress, IoHandler);
> future.join();
> try {
>     session = future.getSession();
> } catch (Exception e) {
>     // e.getCause() tells the error
> }
> it waits till the connection is established. but I want the user to be able to stop the connect process while it is not yet established. for example in cases that Connection_Timeout would occur, the user should wait till the time out is finished. is it possible to stop it whenever we desire?

-- 
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] Commented: (DIRMINA-269) stop SocketConnector.connect()

Posted by "Kristjan Habicht (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/DIRMINA-269?page=comments#action_12436240 ] 
            
Kristjan Habicht commented on DIRMINA-269:
------------------------------------------

This kind of functionality maybe also needed in a proxy server where the connection to the proxied server should be closed if the proxy client is closing the connection.

> stop SocketConnector.connect()
> ------------------------------
>
>                 Key: DIRMINA-269
>                 URL: http://issues.apache.org/jira/browse/DIRMINA-269
>             Project: Directory MINA
>          Issue Type: Improvement
>    Affects Versions: 0.9.5
>            Reporter: Hooman Valibeigi
>
> Currently I'm using the following logic to connect to server
> ConnectFuture future = socket.connect(SocketAddress, IoHandler);
> future.join();
> try {
>     session = future.getSession();
> } catch (Exception e) {
>     // e.getCause() tells the error
> }
> it waits till the connection is established. but I want the user to be able to stop the connect process while it is not yet established. for example in cases that Connection_Timeout would occur, the user should wait till the time out is finished. is it possible to stop it whenever we desire?

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