org.apache.mina.common
Class ConnectFuture

java.lang.Object
  extended by org.apache.mina.common.IoFuture
      extended by org.apache.mina.common.ConnectFuture

public class ConnectFuture
extends IoFuture

An IoFuture for asynchronous connect requests.

Example

 IoConnector connector = ...;
 ConnectFuture future = connector.connect(...);
 future.join(); // Wait until the connection attempt is finished.
 IoSession session = future.getSession();
 session.write(...);
 

Version:
$Rev: 389042 $, $Date: 2006-03-27 16:49:41 +0900 (Mon, 27 Mar 2006) $
Author:
The Apache Directory Project (mina-dev@directory.apache.org)

Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.mina.common.IoFuture
IoFuture.Callback
 
Constructor Summary
ConnectFuture()
           
ConnectFuture(Object lock)
          Creates a new instance which uses the specified object as a lock.
 
Method Summary
 IoSession getSession()
          Returns IoSession which is the result of connect operation.
 boolean isConnected()
          Returns true if the connect operation is finished successfully.
static ConnectFuture newFailedFuture(IOException exception)
          Returns a new ConnectFuture which is already marked as 'failed to connect'.
 void setException(Throwable exception)
          This method is invoked by MINA internally.
 void setSession(IoSession session)
          This method is invoked by MINA internally.
 
Methods inherited from class org.apache.mina.common.IoFuture
getCallback, getLock, getValue, isReady, join, join, setCallback, setValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConnectFuture

public ConnectFuture()

ConnectFuture

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

Method Detail

newFailedFuture

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


getSession

public IoSession getSession()
                     throws IOException
Returns IoSession which is the result of connect operation.

Returns:
null if the connect operation is not finished yet
Throws:
IOException - if connection attempt failed by an exception

isConnected

public boolean isConnected()
Returns true if the connect operation is finished successfully.


setSession

public void setSession(IoSession session)
This method is invoked by MINA internally. Please do not call this method directly.


setException

public void setException(Throwable exception)
This method is invoked by MINA internally. Please do not call this method directly.