Thanks Emmanuel.

You're right, I can catch an "org.apache.mina.core.RuntimeIoException: Failed 
to get the session." exception.

So I guess I'll have to detect this situation in order to proceed.

Thanks once again.

Zigor.

On 22 Jun 2010, at 19:06, Emmanuel Lecharny wrote:

> On Tue, Jun 22, 2010 at 6:28 PM, Zigor Salvador
> <[email protected]>wrote:
> 
>> Hi all,
>> 
>> I'm developing a simple text protocol using TCP connectors/acceptors.
>> 
>> My application needs to send a periodic message to two remote endpoints at
>> addressA and addressB. When the acceptors in addressA and addressB are
>> running, the communication goes as expected (two NioProcessors are
>> automatically created by MINA to handle the two session.write() events).
>> However, when one of the remote acceptors disconnects, none of the messages
>> gets delivered. Things go like this:
>> 
>> I have a send(message) method implemented in the class wrapping the
>> connector object which:
>> 
>> - Checks to see if the corresponding session is connected, based on the
>> destination address of the message.
>> - Performs a session.write with the connector if the corresponding session
>> is active and connected.
>> - Tries to reconnect if that's not the case (ConnectFuture with
>> awaitUninterruptibly()).
>> 
>> My simplified execution loop goes:
>> 
>> while (true)
>> {
>>       send(messageA);       // message objects encapsulate destination
>> addresses...
>>       send(messageB);
>> }
>> 
> 
> It's very likely that you get an exception before the second send is
> executed.
> 
> Add a try/catch around each of the send, and see if it changes something.
> 
> -- 
> Regards,
> Cordialement,
> Emmanuel Lécharny
> www.iktek.com

Reply via email to