return connectFuture.isConnected(); Simple, eh? :)
Trustin On 10/17/07, chihiro <[EMAIL PROTECTED]> wrote: > > 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. > > -- what we call human nature is actually human habit -- http://gleamynode.net/ -- PGP Key ID: 0x0255ECA6