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, setValue
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
await, await, awaitUninterruptibly, awaitUninterruptibly, isDone, join, join
public 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 ConnectFuture
getSession
in interface IoFuture
getSession
in class DefaultIoFuture
IoSession
which is associated with this future.public Throwable getException()
getException
in interface ConnectFuture
public boolean isConnected()
isConnected
in interface ConnectFuture
true
if the connect operation is finished successfully.public boolean isCanceled()
isCanceled
in interface ConnectFuture
true
if the connect operation has been canceled by
ConnectFuture.cancel()
method.public void setSession(IoSession session)
setSession
in interface ConnectFuture
session
- The created session to store in the ConnectFuture insteancepublic void setException(Throwable exception)
setException
in interface ConnectFuture
exception
- The exception to store in the ConnectFuture instancepublic boolean cancel()
cancel
in interface ConnectFuture
true
if the future has been cancelled by this call, false
if the future was already cancelled.public ConnectFuture await() throws InterruptedException
await
in interface ConnectFuture
await
in interface IoFuture
await
in class DefaultIoFuture
InterruptedException
- If the thread is interrupted while waitingpublic ConnectFuture awaitUninterruptibly()
awaitUninterruptibly
in interface ConnectFuture
awaitUninterruptibly
in interface IoFuture
awaitUninterruptibly
in class DefaultIoFuture
public ConnectFuture addListener(IoFutureListener<?> listener)
addListener
in interface ConnectFuture
addListener
in interface IoFuture
addListener
in class DefaultIoFuture
listener
- The listener to addpublic ConnectFuture removeListener(IoFutureListener<?> listener)
removeListener
in interface ConnectFuture
removeListener
in interface IoFuture
removeListener
in class DefaultIoFuture
listener
- The listener to removeCopyright © 2004–2021 Apache MINA Project. All rights reserved.