public class DefaultConnectFuture extends DefaultIoFuture implements ConnectFuture
ConnectFuture
.构造器和说明 |
---|
DefaultConnectFuture()
Creates a new instance.
|
限定符和类型 | 方法和说明 |
---|---|
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.
|
java.lang.Throwable |
getException()
Returns the cause of the connection failure.
|
IoSession |
getSession() |
boolean |
isCanceled() |
boolean |
isConnected() |
static ConnectFuture |
newFailedFuture(java.lang.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(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, 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(java.lang.Throwable exception)
exception
- The exception that caused the failureConnectFuture
which is already marked as 'failed to connect'.public IoSession getSession()
getSession
在接口中 ConnectFuture
getSession
在接口中 IoFuture
getSession
在类中 DefaultIoFuture
IoSession
which is associated with this future.public java.lang.Throwable getException()
getException
在接口中 ConnectFuture
public boolean isConnected()
isConnected
在接口中 ConnectFuture
true
if the connect operation is finished successfully.public boolean isCanceled()
isCanceled
在接口中 ConnectFuture
true
if the connect operation has been canceled by
ConnectFuture.cancel()
method.public void setSession(IoSession session)
setSession
在接口中 ConnectFuture
session
- The created session to store in the ConnectFuture insteancepublic void setException(java.lang.Throwable exception)
setException
在接口中 ConnectFuture
exception
- The exception to store in the ConnectFuture instancepublic boolean cancel()
cancel
在接口中 ConnectFuture
true
if the future has been cancelled by this call, false
if the future was already cancelled.public ConnectFuture await() throws java.lang.InterruptedException
await
在接口中 ConnectFuture
await
在接口中 IoFuture
await
在类中 DefaultIoFuture
java.lang.InterruptedException
- If the thread is interrupted while waitingpublic ConnectFuture awaitUninterruptibly()
awaitUninterruptibly
在接口中 ConnectFuture
awaitUninterruptibly
在接口中 IoFuture
awaitUninterruptibly
在类中 DefaultIoFuture
public ConnectFuture addListener(IoFutureListener<?> listener)
addListener
在接口中 ConnectFuture
addListener
在接口中 IoFuture
addListener
在类中 DefaultIoFuture
listener
- The listener to addpublic ConnectFuture removeListener(IoFutureListener<?> listener)
removeListener
在接口中 ConnectFuture
removeListener
在接口中 IoFuture
removeListener
在类中 DefaultIoFuture
listener
- The listener to remove