directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Niklas Therning <nik...@trillian.se>
Subject Re: [mina] Detecting connect failure without waiting for ConnectFuture
Date Fri, 11 Nov 2005 06:51:38 GMT
Since I badly needed to be able to detected connect failures without
having to wait for a ConnectFuture I added support for it. See the
attached patch. Basically what I've done is to add an extra callback to
IoHandler:

void connectFailed( Throwable cause, Object mark ) throws Exception;

Then there is an extra connect-method in IoConnector:

ConnectFuture connect( SocketAddress address, SocketAddress localAddress,
                           IoHandler handler, Object mark ) throws
IOException;

When connect fails for any of the IoConnector implementations they will
notify the IoHandler specified in the call to connect() and pass along
the mark Object. That's it.

NOTE: I had to move the call to sessionCreated in
DatagramConnectorDelegate.regsiterNew() down a bit to make it less
likely that sessionCreated() is called even if connect fails.

Is this something that could be considered for inclusion in Mina?

/Niklas

Niklas Therning wrote:

>Forgot the [mina] prefix. Sorry.
>
>Hi,
>
>Is there any way I can detect if a connect operation fails without
>having to join or poll the ConnectFuture returned by connect()?
>
>/Niklas
>
>
>  
>


Mime
View raw message