public class DefaultWriteFuture extends DefaultIoFuture implements WriteFuture
WriteFuture.| Constructor and Description |
|---|
DefaultWriteFuture(IoSession session)
Creates a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
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.
|
Throwable |
getException() |
boolean |
isWritten() |
static WriteFuture |
newNotWrittenFuture(IoSession session,
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(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, setValueclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitawait, await, awaitUninterruptibly, awaitUninterruptibly, getSession, isDone, join, joinpublic 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, 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 in interface WriteFuturetrue if the write operation is finished successfully.public Throwable getException()
getException in interface WriteFutureException. Otherwise,
null is returned.public void setWritten()
setWritten in interface WriteFuturepublic void setException(Throwable exception)
setException in interface WriteFutureexception - The exception to store in the Future instancepublic WriteFuture await() throws InterruptedException
await in interface IoFutureawait in interface WriteFutureawait in class DefaultIoFutureInterruptedException - If the thread is interrupted while waitingpublic WriteFuture awaitUninterruptibly()
awaitUninterruptibly in interface IoFutureawaitUninterruptibly in interface WriteFutureawaitUninterruptibly in class DefaultIoFuturepublic WriteFuture 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 IoFutureaddListener in interface WriteFutureaddListener in class DefaultIoFuturelistener - The listener to addpublic WriteFuture removeListener(IoFutureListener<?> listener)
listener so it won't be notified when
the future is completed.removeListener in interface IoFutureremoveListener in interface WriteFutureremoveListener in class DefaultIoFuturelistener - The listener to removeCopyright © 2004–2024 Apache MINA Project. All rights reserved.