[mina] Detecting connect failure without waiting for ConnectFuture
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > Apache Server configuration support > Apache Directory Project > [mina] Detecting connect failure without waiting for ConnectFuture




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    [mina] Detecting connect failure without waiting for ConnectFuture  
Niklas Therning


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
11-08-05 10:45 PM

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








[ Post a follow-up to this message ]



    Re: [mina] Detecting connect failure without waiting for ConnectFuture  
Niklas Therning


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
11-11-05 07:45 AM

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







[ Post a follow-up to this message ]



    Re: [mina] Detecting connect failure without waiting for ConnectFuture  
Trustin Lee


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
11-11-05 07:45 AM

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-8FIgwK2HfyIwFerOooGFRg@public.gmane.org>:
>
> 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:
> 
>
>
>
>


--
what we call human nature is actually human habit
--
http://gleamynode.net/






[ Post a follow-up to this message ]



    Re: [mina] Detecting connect failure without waiting for ConnectFuture  
Trustin Lee


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
11-11-05 10:45 PM

I've added a JIRA issue here:

http://issues.apache.org/jira/browse/DIRMINA-120

I think this is the most convenient and elegant way to handle individual I/O
requests. WDYT?

Trustin

2005/11/11, Trustin Lee <trustin-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:
>
> 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-8FIgwK2HfyIwFerOooGFRg@public.gmane.o
rg>: 
>
>
> --
> what we call human nature is actually human habit
> --
> http://gleamynode.net/




--
what we call human nature is actually human habit
--
http://gleamynode.net/






[ Post a follow-up to this message ]



    Re: [mina] Detecting connect failure without waiting for ConnectFuture  
Niklas Therning


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
11-12-05 07:45 AM

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-8FIgwK2HfyIwFerOooGFRg@public.gmane.o
rg
> <mailto:niklas-8FIgwK2HfyIwFerOooGFRg@public.gmane.org>>:
>
>     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:
> 
>
>
>
>
>
>
> --
> what we call human nature is actually human habit
> --
> http://gleamynode.net/ <http://gleamynode.net/>








[ Post a follow-up to this message ]



    Re: [mina] Detecting connect failure without waiting for ConnectFuture  
Niklas Therning


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
11-12-05 07:45 AM

Looks great to me. This way you don't have to add any new methods to
IoHandler. I could have a look at it and implement it if you haven't
started on it already. Just let me know.

Trustin Lee wrote:

> I've added a JIRA issue here:
>
> http://issues.apache.org/jira/browse/DIRMINA-120
>
> I think this is the most convenient and elegant way to handle
> individual I/O requests.  WDYT?
>
> Trustin








[ Post a follow-up to this message ]



    RE: [mina] Detecting connect failure without waiting for ConnectFuture  
Irving, Dave


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
11-12-05 12:45 PM

> Looks great to me. This way you don't have to add any new methods to
IoHandler. I could have a look at it and implement it if you haven't
started on it already. Just let me know.

Im really really sorry - I just saw this email. I checked JIRA earlier
and saw the feature request and submitted a patch as I had half an hour
spare this morning. Didn't realise it had already been claimed :o)
I extended it slightly by adding the ability to listen for the result of
any IoFuture: ConnectFuture expands on this to support the interface
outlined in JIRA.

Dave=20

-----Original Message-----
From: Niklas Therning [mailto:niklas-8FIgwK2HfyIwFerOooGFRg@public.gmane
.org]=20
Sent: 12 November 2005 07:43
To: Apache Directory Developers List
Subject: Re: [mina] Detecting connect failure without waiting for
ConnectFuture

Looks great to me. This way you don't have to add any new methods to
IoHandler. I could have a look at it and implement it if you haven't
started on it already. Just let me know.

Trustin Lee wrote:

> I've added a JIRA issue here:
>
> http://issues.apache.org/jira/browse/DIRMINA-120
>
> I think this is the most convenient and elegant way to handle=20
> individual I/O requests.  WDYT?
>
> Trustin




This e-mail and any attachment is for authorised use by the intended recipi=
ent(s) only. It may contain proprietary material, confidential information =
and/or be subject to legal privilege. It should not be copied, disclosed to=
, retained or used by, any other party. If you are not an intended recipien=
t then please promptly delete this e-mail and any attachment and all copies=
and inform the sender. Thank you.






[ Post a follow-up to this message ]



    Re: [mina] Detecting connect failure without waiting for ConnectFuture  
Niklas Therning


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
11-13-05 12:45 PM

Irving, Dave wrote:
 
>IoHandler. I could have a look at it and implement it if you haven't
>started on it already. Just let me know.
>
>Im really really sorry - I just saw this email. I checked JIRA earlier
>and saw the feature request and submitted a patch as I had half an hour
>spare this morning. Didn't realise it had already been claimed :o)
>I extended it slightly by adding the ability to listen for the result of
>any IoFuture: ConnectFuture expands on this to support the interface
>outlined in JIRA.
>
>Dave
>
>
It's ok man. Don't worry about it. :-D

BTW, the patch looks really great! Thanks.

/Niklas







[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 03:28 PM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register