|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ReadFuture
An IoFuture
for asynchronous read requests
.
IoSession session = ...; // useReadOperation must be enabled to use read operation. session.getConfig().setUseReadOperation(true); ReadFuture future = session.read(); // Wait until a message is received. future.await(); try { Object message = future.getMessage(); } catch (Exception e) { ... }
Method Summary | |
---|---|
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()
Returns the cause of the read failure if and only if the read operation has failed due to an Exception . |
Object |
getMessage()
Returns the received message. |
boolean |
isClosed()
Returns true if the IoSession associated with this
future has been closed. |
boolean |
isRead()
Returns true if a message was received successfully. |
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 cause)
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. |
Methods inherited from interface org.apache.mina.core.future.IoFuture |
---|
await, await, awaitUninterruptibly, awaitUninterruptibly, getSession, isDone, join, join |
Method Detail |
---|
Object getMessage()
IoSession
has been closed.
RuntimeException
- if read or any relevant operation has failed.boolean isRead()
boolean isClosed()
IoSession
associated with this
future has been closed.
Throwable getException()
Exception
. Otherwise,
null is returned.
void setRead(Object message)
void setClosed()
IoSession
is closed. This method is invoked
by MINA internally. Please do not call this method directly.
void setException(Throwable cause)
ReadFuture await() throws InterruptedException
IoFuture
await
in interface IoFuture
InterruptedException
ReadFuture awaitUninterruptibly()
IoFuture
awaitUninterruptibly
in interface IoFuture
ReadFuture addListener(IoFutureListener<?> listener)
IoFuture
addListener
in interface IoFuture
ReadFuture removeListener(IoFutureListener<?> listener)
IoFuture
removeListener
in interface IoFuture
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |