public class DefaultWriteFuture extends DefaultIoFuture implements WriteFuture
WriteFuture
.构造器和说明 |
---|
DefaultWriteFuture(IoSession session)
Creates a new instance.
|
限定符和类型 | 方法和说明 |
---|---|
WriteFuture |
addListener(IoFutureListener<?> listener)
Adds an event listener which is notified when
this future is completed.
|
WriteFuture |
await()
Wait for the asynchronous operation to complete.
|
WriteFuture |
awaitUninterruptibly()
Wait for the asynchronous operation to complete uninterruptibly.
|
java.lang.Throwable |
getException() |
boolean |
isWritten() |
static WriteFuture |
newNotWrittenFuture(IoSession session,
java.lang.Throwable cause)
Returns a new
DefaultWriteFuture which is already marked as 'not written'. |
static WriteFuture |
newWrittenFuture(IoSession session)
Returns a new
DefaultWriteFuture which is already marked as 'written'. |
WriteFuture |
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 cause of the write failure, and notifies all threads waiting
for this future.
|
void |
setWritten()
Sets the message is written, and notifies all threads waiting for
this future.
|
await, await, awaitUninterruptibly, awaitUninterruptibly, getSession, getValue, isDone, join, join, setValue
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
await, await, awaitUninterruptibly, awaitUninterruptibly, getSession, isDone, join, join
public DefaultWriteFuture(IoSession session)
session
- The associated sessionpublic static WriteFuture newWrittenFuture(IoSession session)
DefaultWriteFuture
which is already marked as 'written'.session
- The associated sessionpublic static WriteFuture newNotWrittenFuture(IoSession session, java.lang.Throwable cause)
DefaultWriteFuture
which is already marked as 'not written'.session
- The associated sessioncause
- The reason why the message has not be writtenpublic boolean isWritten()
isWritten
在接口中 WriteFuture
public java.lang.Throwable getException()
getException
在接口中 WriteFuture
Exception
. Otherwise,
null is returned.public void setWritten()
setWritten
在接口中 WriteFuture
public void setException(java.lang.Throwable exception)
setException
在接口中 WriteFuture
exception
- The exception to store in the Future instancepublic WriteFuture await() throws java.lang.InterruptedException
await
在接口中 IoFuture
await
在接口中 WriteFuture
await
在类中 DefaultIoFuture
java.lang.InterruptedException
- If the thread is interrupted while waitingpublic WriteFuture awaitUninterruptibly()
awaitUninterruptibly
在接口中 IoFuture
awaitUninterruptibly
在接口中 WriteFuture
awaitUninterruptibly
在类中 DefaultIoFuture
public WriteFuture addListener(IoFutureListener<?> listener)
addListener
在接口中 IoFuture
addListener
在接口中 WriteFuture
addListener
在类中 DefaultIoFuture
listener
- The listener to addpublic WriteFuture removeListener(IoFutureListener<?> listener)
removeListener
在接口中 IoFuture
removeListener
在接口中 WriteFuture
removeListener
在类中 DefaultIoFuture
listener
- The listener to remove