|
XNIO version 1.0.0.GA | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.jboss.xnio.AbstractIoFuture<T>
T - the type of result that this operation producespublic abstract class AbstractIoFuture<T>

An abstract base class for IoFuture objects. Used to easily produce implementations.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface org.jboss.xnio.IoFuture |
|---|
IoFuture.Notifier<T>, IoFuture.Status |
| Constructor Summary | |
|---|---|
protected |
AbstractIoFuture()
Construct a new instance. |
| Method Summary | |
|---|---|
void |
addNotifier(IoFuture.Notifier<T> notifier)
Add a notifier to be called when this operation is complete. |
IoFuture.Status |
await()
Wait for the operation to complete. |
IoFuture.Status |
await(TimeUnit timeUnit,
long time)
Wait for the operation to complete, with a timeout. |
IoFuture.Status |
awaitInterruptibly()
Wait for the operation to complete. |
IoFuture.Status |
awaitInterruptibly(TimeUnit timeUnit,
long time)
Wait for the operation to complete, with a timeout. |
abstract IoFuture<T> |
cancel()
Cancel an operation. |
protected boolean |
finishCancel()
Acknowledge the cancellation of this operation. |
T |
get()
Get the result of the operation. |
IOException |
getException()
Get the failure reason. |
T |
getInterruptibly()
Get the result of the operation. |
IoFuture.Status |
getStatus()
Get the current status. |
protected abstract void |
runNotifier(IoFuture.Notifier<T> notifier)
Run a notifier. |
protected boolean |
setException(IOException exception)
Set the exception for this operation. |
protected boolean |
setResult(T result)
Set the result for this operation. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
protected AbstractIoFuture()
| Method Detail |
|---|
public IoFuture.Status getStatus()
getStatus in interface IoFuture<T>public IoFuture.Status await()
IoFuture.Status.WAITING.
await in interface IoFuture<T>
public IoFuture.Status await(TimeUnit timeUnit,
long time)
IoFuture.Status.WAITING,
or the given time elapses. If the time elapses before the operation is complete, IoFuture.Status.TIMED_OUT is
returned.
await in interface IoFuture<T>timeUnit - the time unittime - the amount of time to wait
IoFuture.Status.TIMED_OUT if the timeout expired
public IoFuture.Status awaitInterruptibly()
throws InterruptedException
IoFuture.Status.WAITING,
or the current thread is interrupted.
awaitInterruptibly in interface IoFuture<T>InterruptedException - if the operation is interrupted
public IoFuture.Status awaitInterruptibly(TimeUnit timeUnit,
long time)
throws InterruptedException
IoFuture.Status.WAITING,
the given time elapses, or the current thread is interrupted. If the time elapses before the operation is complete, IoFuture.Status.TIMED_OUT is
returned.
awaitInterruptibly in interface IoFuture<T>timeUnit - the time unittime - the amount of time to wait
IoFuture.Status.TIMED_OUT if the timeout expired
InterruptedException - if the operation is interrupted
public T get()
throws IOException
get in interface IoFuture<T>IOException - if the operation failed
public T getInterruptibly()
throws IOException,
InterruptedException
getInterruptibly in interface IoFuture<T>IOException - if the operation failed
InterruptedException - if the operation is interrupted
public IOException getException()
throws IllegalStateException
getException in interface IoFuture<T>IllegalStateException - if the operation did not failpublic void addNotifier(IoFuture.Notifier<T> notifier)
addNotifier in interface IoFuture<T>notifier - the notifier to be calledprotected boolean setException(IOException exception)
exception - the exception to set
false if the operation was already completed, true otherwiseprotected boolean setResult(T result)
result - the result to set
false if the operation was already completed, true otherwiseprotected boolean finishCancel()
false if the operation was already completed, true otherwisepublic abstract IoFuture<T> cancel()
finishCancel() method to indicate that the cancel was successful. If
cancellation is not supported, this method may be a no-op.
cancel in interface IoFuture<T>IoFuture instanceprotected abstract void runNotifier(IoFuture.Notifier<T> notifier)
notifier - the notifier to run
|
XNIO version 1.0.0.GA | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||