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 theIoSession
which is associated with this future.boolean
Returns true if the connect operation is finished successfully.static ConnectFuture
newFailedFuture
(Throwable exception) Returns a newConnectFuture
which is already marked as 'failed to connect'.void
setException
(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 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 newConnectFuture
which is already marked as 'failed to connect'. -
getSession
Description copied from interface:IoFuture
Returns theIoSession
which is associated with this future.- Specified by:
getSession
in interfaceConnectFuture
- Specified by:
getSession
in interfaceIoFuture
- Overrides:
getSession
in 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:ConnectFuture
Returns true if the connect operation is finished successfully.- Specified by:
isConnected
in interfaceConnectFuture
-
setSession
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 interfaceConnectFuture
-
setException
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 interfaceConnectFuture
-