public interface ConnectFuture extends IoFuture
IoFuture
for asynchronous connect requests.
IoConnector connector = ...; ConnectFuture future = connector.connect(...); future.join(); // Wait until the connection attempt is finished. IoSession session = future.getSession(); session.write(...);
Modifier and Type | Method and Description |
---|---|
ConnectFuture |
addListener(IoFutureListener<?> listener)
Adds an event listener which is notified when
this future is completed.
|
ConnectFuture |
await()
Wait for the asynchronous operation to complete.
|
ConnectFuture |
awaitUninterruptibly()
Wait for the asynchronous operation to complete uninterruptibly.
|
void |
cancel()
Cancels the connection attempt and notifies all threads waiting for
this future.
|
java.lang.Throwable |
getException()
Returns the cause of the connection failure.
|
IoSession |
getSession()
Returns
IoSession which is the result of connect operation. |
boolean |
isCanceled()
Returns
true if the connect operation has been canceled by
cancel() method. |
boolean |
isConnected()
Returns true if the connect operation is finished successfully.
|
ConnectFuture |
removeListener(IoFutureListener<?> listener)
Removes an existing event listener so it won't be notified when
the future is completed.
|
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.
|
await, await, awaitUninterruptibly, awaitUninterruptibly, isDone, join, join
IoSession getSession()
IoSession
which is the result of connect operation.getSession
in interface IoFuture
java.lang.RuntimeException
- if connection attempt failed by an exceptionjava.lang.Throwable getException()
boolean isConnected()
boolean isCanceled()
true
if the connect operation has been canceled by
cancel()
method.void setSession(IoSession session)
void setException(java.lang.Throwable exception)
void cancel()
ConnectFuture await() throws java.lang.InterruptedException
IoFuture
ConnectFuture awaitUninterruptibly()
IoFuture
awaitUninterruptibly
in interface IoFuture
ConnectFuture addListener(IoFutureListener<?> listener)
IoFuture
addListener
in interface IoFuture
ConnectFuture removeListener(IoFutureListener<?> listener)
IoFuture
removeListener
in interface IoFuture
Copyright © 2004-2019 Apache MINA Project. All Rights Reserved.