Package org.apache.mina.common
Interface ConnectFuture
-
- All Superinterfaces:
IoFuture
- All Known Implementing Classes:
DefaultConnectFuture
public interface ConnectFuture extends IoFuture
AnIoFuturefor 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(...);
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description IoSessiongetSession()ReturnsIoSessionwhich is the result of connect operation.booleanisConnected()Returns true if the connect operation is finished successfully.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 interface org.apache.mina.common.IoFuture
addListener, getLock, isReady, join, join, removeListener
-
-
-
-
Method Detail
-
getSession
IoSession getSession() throws RuntimeIOException
ReturnsIoSessionwhich is the result of connect operation.- Specified by:
getSessionin interfaceIoFuture- Returns:
- null if the connect operation is not finished yet
- Throws:
RuntimeIOException- if connection attempt failed by an exception
-
isConnected
boolean isConnected()
Returns true if the connect operation is finished successfully.
-
setSession
void setSession(IoSession session)
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.
-
setException
void setException(java.lang.Throwable exception)
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.
-
-