public class DefaultConnectFuture extends DefaultIoFuture implements ConnectFuture
ConnectFuture.| Constructor and Description |
|---|
DefaultConnectFuture()
Creates a new instance.
|
| 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.
|
boolean |
cancel()
Cancels the connection attempt and notifies all threads waiting for
this future.
|
Throwable |
getException()
Returns the cause of the connection failure.
|
IoSession |
getSession() |
boolean |
isCanceled() |
boolean |
isConnected() |
static ConnectFuture |
newFailedFuture(Throwable exception)
Creates a new instance of a Connection Failure, with the associated cause.
|
ConnectFuture |
removeListener(IoFutureListener<?> listener)
Removes an existing event
listener so it won't be notified when
the future is completed. |
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.
|
await, await, awaitUninterruptibly, awaitUninterruptibly, getValue, isDone, join, join, setValueclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitawait, await, awaitUninterruptibly, awaitUninterruptibly, isDone, join, joinpublic static ConnectFuture newFailedFuture(Throwable exception)
exception - The exception that caused the failureConnectFuture which is already marked as 'failed to connect'.public IoSession getSession()
getSession in interface ConnectFuturegetSession in interface IoFuturegetSession in class DefaultIoFutureIoSession which is associated with this future.public Throwable getException()
getException in interface ConnectFuturenull if the connect operation is not finished yet,
or if the connection attempt is successful, otherwise returns
the cause of the exceptionpublic boolean isConnected()
isConnected in interface ConnectFuturetrue if the connect operation is finished successfully.public boolean isCanceled()
isCanceled in interface ConnectFuturetrue if the connect operation has been canceled by
ConnectFuture.cancel() method.public void setSession(IoSession session)
setSession in interface ConnectFuturesession - The created session to store in the ConnectFuture insteancepublic void setException(Throwable exception)
setException in interface ConnectFutureexception - The exception to store in the ConnectFuture instancepublic boolean cancel()
cancel in interface ConnectFuturetrue if the future has been cancelled by this call, false
if the future was already cancelled.public ConnectFuture await() throws InterruptedException
await in interface ConnectFutureawait in interface IoFutureawait in class DefaultIoFutureInterruptedException - If the thread is interrupted while waitingpublic ConnectFuture awaitUninterruptibly()
awaitUninterruptibly in interface ConnectFutureawaitUninterruptibly in interface IoFutureawaitUninterruptibly in class DefaultIoFuturepublic ConnectFuture addListener(IoFutureListener<?> listener)
listener which is notified when
this future is completed. If the listener is added
after the completion, the listener is directly notified.addListener in interface ConnectFutureaddListener in interface IoFutureaddListener in class DefaultIoFuturelistener - The listener to addpublic ConnectFuture removeListener(IoFutureListener<?> listener)
listener so it won't be notified when
the future is completed.removeListener in interface ConnectFutureremoveListener in interface IoFutureremoveListener in class DefaultIoFuturelistener - The listener to removeCopyright © 2004–2024 Apache MINA Project. All rights reserved.