public class DefaultReadFuture extends DefaultIoFuture implements ReadFuture
WriteFuture.| Constructor and Description |
|---|
DefaultReadFuture(IoSession session)
Creates a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
ReadFuture |
addListener(IoFutureListener<?> listener)
Adds an event
listener which is notified when
this future is completed. |
ReadFuture |
await()
Wait for the asynchronous operation to complete.
|
ReadFuture |
awaitUninterruptibly()
Wait for the asynchronous operation to complete uninterruptibly.
|
Throwable |
getException() |
Object |
getMessage()
Get the read message.
|
boolean |
isClosed() |
boolean |
isRead() |
ReadFuture |
removeListener(IoFutureListener<?> listener)
Removes an existing event
listener so it won't be notified when
the future is completed. |
void |
setClosed()
Sets the associated
IoSession is closed. |
void |
setException(Throwable exception)
Sets the cause of the read failure, and notifies all threads waiting
for this future.
|
void |
setRead(Object message)
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 DefaultReadFuture(IoSession session)
session - The associated sessionpublic Object getMessage()
getMessage in interface ReadFuturenull if this
future is not ready or the associated IoSession has been closed.public boolean isRead()
isRead in interface ReadFuturetrue if a message was received successfully.public boolean isClosed()
isClosed in interface ReadFuturetrue if the IoSession associated with this
future has been closed.public Throwable getException()
getException in interface ReadFutureException. Otherwise,
null is returned.public void setClosed()
IoSession is closed. This method is invoked
by MINA internally. Please do not call this method directly.setClosed in interface ReadFuturepublic void setRead(Object message)
setRead in interface ReadFuturemessage - The received message to store in this futurepublic void setException(Throwable exception)
setException in interface ReadFutureexception - The exception to store in the Future instancepublic ReadFuture await() throws InterruptedException
await in interface IoFutureawait in interface ReadFutureawait in class DefaultIoFutureInterruptedException - If the thread is interrupted while waitingpublic ReadFuture awaitUninterruptibly()
awaitUninterruptibly in interface IoFutureawaitUninterruptibly in interface ReadFutureawaitUninterruptibly in class DefaultIoFuturepublic ReadFuture 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 ReadFutureaddListener in class DefaultIoFuturelistener - The listener to addpublic ReadFuture removeListener(IoFutureListener<?> listener)
listener so it won't be notified when
the future is completed.removeListener in interface IoFutureremoveListener in interface ReadFutureremoveListener in class DefaultIoFuturelistener - The listener to removeCopyright © 2004–2024 Apache MINA Project. All rights reserved.