Hi,

I am caching ConnectFuture in my client code and when during the call to
send bytes to the server,
I will test the connection by calling this isConnected() method:

/**
 * @return true if we are connected to the remote peer, else false
 */
private final boolean isConnected()
{
    IoSession session;
    try
    {
        session = ( m_connectFuture != null ) ? m_connectFuture.getSession()
: null;
    } catch( RuntimeIOException e ) 
    {
        return false;
    }
    return( m_connectFuture != null && m_connectFuture.isConnected() &&
session != null && session.isConnected() );
}

If it returns false, I will attempt a reconnection. It is working fine right
now. But I want to know if
there are other alternative solutions. Thanks all.

chihiro
-- 
View this message in context: 
http://www.nabble.com/Implementation-of-isConnected%28%29-tf4637998s16868.html#a13246352
Sent from the Apache MINA Support Forum mailing list archive at Nabble.com.

Reply via email to