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 Sat, 12 Nov 2005 07:28:57 GMT
I'm afraid exceptionCaught won't work since it expects an IoSession:

void exceptionCaught( IoSession session, Throwable cause ) throws Exception;

When a connect fails there is no session yet. (Well actually there is in
the Datagram case but I'm not sure if it is right to use it before
sessionCreated has been called on it.)

Trustin Lee wrote:

> What do you think about just using exceptionCaught handler?  I think
> you can use 'instanceof ConnectException'.  Let me know if you like it.
>
> Trustin
>
> 2005/11/11, Niklas Therning < niklas@trillian.se
> <mailto:niklas@trillian.se>>:
>
>     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
>     >
>     >
>     >
>     >
>
>
>
>
>
>
> -- 
> what we call human nature is actually human habit
> --
> http://gleamynode.net/ <http://gleamynode.net/>



Mime
View raw message