org.apache.mina.common.support
Class DefaultConnectFuture

java.lang.Object
  extended by org.apache.mina.common.support.DefaultIoFuture
      extended by org.apache.mina.common.support.DefaultConnectFuture
All Implemented Interfaces:
ConnectFuture, IoFuture

public class DefaultConnectFuture
extends DefaultIoFuture
implements ConnectFuture

A default implementation of ConnectFuture.


Constructor Summary
DefaultConnectFuture()
          Creates a new instance.
DefaultConnectFuture(java.lang.Object lock)
          Creates a new instance which uses the specified object as a lock.
 
Method Summary
 IoSession getSession()
          Returns the IoSession which is associated with this future.
 boolean isConnected()
          Returns true if the connect operation is finished successfully.
static ConnectFuture newFailedFuture(java.lang.Throwable exception)
          Returns a new ConnectFuture which is already marked as 'failed to connect'.
 void setException(java.lang.Throwable exception)
          Sets the exception caught due to connection failure and notifies all threads waiting for this future.
 void setSession(IoSession session)
          Sets the newly connected session and notifies all threads waiting for this future.
 
Methods inherited from class org.apache.mina.common.support.DefaultIoFuture
addListener, getLock, getValue, isReady, join, join, removeListener, setValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.mina.common.IoFuture
addListener, getLock, isReady, join, join, removeListener
 

Constructor Detail

DefaultConnectFuture

public DefaultConnectFuture()
Creates a new instance.


DefaultConnectFuture

public DefaultConnectFuture(java.lang.Object lock)
Creates a new instance which uses the specified object as a lock.

Method Detail

newFailedFuture

public static ConnectFuture newFailedFuture(java.lang.Throwable exception)
Returns a new ConnectFuture which is already marked as 'failed to connect'.


getSession

public IoSession getSession()
                     throws RuntimeIOException
Description copied from interface: IoFuture
Returns the IoSession which is associated with this future.

Specified by:
getSession in interface ConnectFuture
Specified by:
getSession in interface IoFuture
Overrides:
getSession in class DefaultIoFuture
Returns:
null if the connect operation is not finished yet
Throws:
RuntimeIOException - if connection attempt failed by an exception

isConnected

public boolean isConnected()
Description copied from interface: ConnectFuture
Returns true if the connect operation is finished successfully.

Specified by:
isConnected in interface ConnectFuture

setSession

public void setSession(IoSession session)
Description copied from interface: ConnectFuture
Sets the newly connected session and notifies all threads waiting for this future. This method is invoked by MINA internally. Please do not call this method directly.

Specified by:
setSession in interface ConnectFuture

setException

public void setException(java.lang.Throwable exception)
Description copied from interface: ConnectFuture
Sets the exception caught due to connection failure and notifies all threads waiting for this future. This method is invoked by MINA internally. Please do not call this method directly.

Specified by:
setException in interface ConnectFuture