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, setValue
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
await, await, awaitUninterruptibly, awaitUninterruptibly, getSession, isDone, join, join
public DefaultReadFuture(IoSession session)
session
- The associated sessionpublic Object getMessage()
getMessage
in interface ReadFuture
IoSession
has been closed.public boolean isRead()
isRead
in interface ReadFuture
public boolean isClosed()
isClosed
in interface ReadFuture
IoSession
associated with this
future has been closed.public Throwable getException()
getException
in interface ReadFuture
Exception
. 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 ReadFuture
public void setRead(Object message)
setRead
in interface ReadFuture
message
- The received message to store in this futurepublic void setException(Throwable exception)
setException
in interface ReadFuture
exception
- The exception to store in the Future instancepublic ReadFuture await() throws InterruptedException
await
in interface IoFuture
await
in interface ReadFuture
await
in class DefaultIoFuture
InterruptedException
- If the thread is interrupted while waitingpublic ReadFuture awaitUninterruptibly()
awaitUninterruptibly
in interface IoFuture
awaitUninterruptibly
in interface ReadFuture
awaitUninterruptibly
in class DefaultIoFuture
public ReadFuture addListener(IoFutureListener<?> listener)
addListener
in interface IoFuture
addListener
in interface ReadFuture
addListener
in class DefaultIoFuture
listener
- The listener to addpublic ReadFuture removeListener(IoFutureListener<?> listener)
removeListener
in interface IoFuture
removeListener
in interface ReadFuture
removeListener
in class DefaultIoFuture
listener
- The listener to removeCopyright © 2004–2021 Apache MINA Project. All rights reserved.