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 IoSession
getSession()
Returns theIoSession
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 newConnectFuture
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
-
-
-
-
Method Detail
-
newFailedFuture
public static ConnectFuture newFailedFuture(java.lang.Throwable exception)
Returns a newConnectFuture
which is already marked as 'failed to connect'.
-
getSession
public IoSession getSession() throws RuntimeIOException
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
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 interfaceConnectFuture
-
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 interfaceConnectFuture
-
-