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
A default implementation of
ConnectFuture.-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new instance.DefaultConnectFuture(Object lock) Creates a new instance which uses the specified object as a lock. -
Method Summary
Modifier and TypeMethodDescriptionReturns theIoSessionwhich is associated with this future.booleanReturns true if the connect operation is finished successfully.static ConnectFuturenewFailedFuture(Throwable exception) Returns a newConnectFuturewhich is already marked as 'failed to connect'.voidsetException(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, setValueMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.mina.common.IoFuture
addListener, getLock, isReady, join, join, removeListener
-
Constructor Details
-
DefaultConnectFuture
public DefaultConnectFuture()Creates a new instance. -
DefaultConnectFuture
Creates a new instance which uses the specified object as a lock.
-
-
Method Details
-
newFailedFuture
Returns a newConnectFuturewhich is already marked as 'failed to connect'. -
getSession
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
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
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
-