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 [EMAIL PROTECTED] 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.