Package org.apache.mina.common.support
Class DefaultConnectFuture
- java.lang.Object
-
- org.apache.mina.common.support.DefaultIoFuture
-
- org.apache.mina.common.support.DefaultConnectFuture
-
- All Implemented Interfaces:
ConnectFuture,IoFuture
public class DefaultConnectFuture extends DefaultIoFuture implements ConnectFuture
A default implementation ofConnectFuture.
-
-
Constructor Summary
Constructors Constructor Description DefaultConnectFuture()Creates a new instance.DefaultConnectFuture(java.lang.Object lock)Creates a new instance which uses the specified object as a lock.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description IoSessiongetSession()Returns theIoSessionwhich is associated with this future.booleanisConnected()Returns true if the connect operation is finished successfully.static ConnectFuturenewFailedFuture(java.lang.Throwable exception)Returns a newConnectFuturewhich is already marked as 'failed to connect'.voidsetException(java.lang.Throwable exception)Sets the exception caught due to connection failure and notifies all threads waiting for this future.voidsetSession(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
-
-
-
-
Method Detail
-
newFailedFuture
public static ConnectFuture newFailedFuture(java.lang.Throwable exception)
Returns a newConnectFuturewhich is already marked as 'failed to connect'.
-
getSession
public IoSession getSession() throws RuntimeIOException
Description copied from interface:IoFutureReturns theIoSessionwhich is associated with this future.- Specified by:
getSessionin interfaceConnectFuture- Specified by:
getSessionin interfaceIoFuture- Overrides:
getSessionin classDefaultIoFuture- 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:ConnectFutureReturns true if the connect operation is finished successfully.- Specified by:
isConnectedin interfaceConnectFuture
-
setSession
public void setSession(IoSession session)
Description copied from interface:ConnectFutureSets 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:
setSessionin interfaceConnectFuture
-
setException
public void setException(java.lang.Throwable exception)
Description copied from interface:ConnectFutureSets 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:
setExceptionin interfaceConnectFuture
-
-