directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Niklas Therning (JIRA)" <j...@apache.org>
Subject [jira] Commented: (DIRMINA-135) exception during a connector.connect() aren't caught by filters
Date Wed, 30 Nov 2005 14:50:31 GMT
    [ http://issues.apache.org/jira/browse/DIRMINA-135?page=comments#action_12358912 ] 

Niklas Therning commented on DIRMINA-135:
-----------------------------------------

A reconnection filter would be great to have. But from what I understand you have a filter
which tries to reconnect if the initial connect fails, right? Why not just do this in a while-loop
instead?

while (!connected) {
  try {
    connector.connect();
    connected = true;
  } catch (ConnectException ce) {}
}

I think it would be more useful to have a filter which reconnects if an already established
connection fails for some reason. And I think that's already possible in MINA 0.8 (if you
can live with the blocking connect() call).

Another problem with this approach is that it won't work in MINA 0.9 and beyond. In MINA 0.9
there won't be a filter chain until a session has been created successfully so it won't be
possible to call exceptionCaught() on the chain since there simply is no chain.


> exception during a connector.connect() aren't caught by filters
> ---------------------------------------------------------------
>
>          Key: DIRMINA-135
>          URL: http://issues.apache.org/jira/browse/DIRMINA-135
>      Project: Directory MINA
>         Type: Bug
>     Versions: 0.8.1, 0.8, 0.8.2
>  Environment: MINA 0.8 and a SocketConnector
>     Reporter: Julien Vermillard
>     Priority: Minor

>
> I try to do a reconnection filter, automaticly connecting and reconnecting a connector
until it works.
> if theinitial connector.connect(...) fail, and exception is thrown, but it's not caught
by IoFilter chain. It's not really a bug I think but I added a simple fix :
> in SocketConnector class in the connect method :
>     public IoSession connect( SocketAddress address, SocketAddress localAddress,
>                               int timeout, IoHandler handler ) throws IOException
> I changed :
> ....
>         if( request.exception != null )
>         {
>             ExceptionUtil.throwException( request.exception );
>         }
> ....
> into
> ....
>         if( request.exception != null )
>         {
>        	    filters.exceptionCaught(null,request.exception );
>             ExceptionUtil.throwException( request.exception );
>         }
> ....
> and now my filters get the exception normaly, perhaps it's an idea to add it to MINA
0.8 ?

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


Mime
View raw message