|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
T
- the type of result that this operation producespublic interface IoFuture<T>
The future result of an asynchronous request. Use instances of this interface to retrieve the final status of an asynchronous operation.
Nested Class Summary | |
---|---|
static class |
IoFuture.HandlingNotifier<T,A>
A base notifier class that calls the designated handler method on notification. |
static interface |
IoFuture.Notifier<T,A>
A notifier that handles changes in the status of an IoFuture . |
static class |
IoFuture.Status
The current status of an asynchronous operation. |
Method Summary | ||
---|---|---|
|
addNotifier(IoFuture.Notifier<T,A> notifier,
A attachment)
Add a notifier to be called when this operation is complete. |
|
IoFuture.Status |
await()
Wait for the operation to complete. |
|
IoFuture.Status |
await(long time,
java.util.concurrent.TimeUnit timeUnit)
Wait for the operation to complete, with a timeout. |
|
IoFuture.Status |
awaitInterruptibly()
Wait for the operation to complete. |
|
IoFuture.Status |
awaitInterruptibly(long time,
java.util.concurrent.TimeUnit timeUnit)
Wait for the operation to complete, with a timeout. |
|
IoFuture<T> |
cancel()
Cancel an operation. |
|
T |
get()
Get the result of the operation. |
|
java.io.IOException |
getException()
Get the failure reason. |
|
T |
getInterruptibly()
Get the result of the operation. |
|
IoFuture.Status |
getStatus()
Get the current status. |
Method Detail |
---|
IoFuture<T> cancel()
IoFuture
instanceIoFuture.Status getStatus()
IoFuture.Status await()
IoFuture.Status.WAITING
.
IoFuture.Status await(long time, java.util.concurrent.TimeUnit timeUnit)
IoFuture.Status.WAITING
,
or the given time elapses. If the time elapses before the operation is complete, IoFuture.Status.WAITING
is
returned.
time
- the amount of time to waittimeUnit
- the time unit
IoFuture.Status.WAITING
if the timeout expiredIoFuture.Status awaitInterruptibly() throws java.lang.InterruptedException
IoFuture.Status.WAITING
,
or the current thread is interrupted.
java.lang.InterruptedException
- if the operation is interruptedIoFuture.Status awaitInterruptibly(long time, java.util.concurrent.TimeUnit timeUnit) throws java.lang.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.WAITING
is
returned.
time
- the amount of time to waittimeUnit
- the time unit
IoFuture.Status.WAITING
if the timeout expired
java.lang.InterruptedException
- if the operation is interruptedT get() throws java.io.IOException, java.util.concurrent.CancellationException
java.io.IOException
- if the operation failed
java.util.concurrent.CancellationException
- if the operation was cancelledT getInterruptibly() throws java.io.IOException, java.lang.InterruptedException, java.util.concurrent.CancellationException
java.io.IOException
- if the operation failed
java.lang.InterruptedException
- if the operation is interrupted
java.util.concurrent.CancellationException
- if the operation was cancelledjava.io.IOException getException() throws java.lang.IllegalStateException
java.lang.IllegalStateException
- if the operation did not fail<A> IoFuture<T> addNotifier(IoFuture.Notifier<T,A> notifier, A attachment)
A
- the attachment typenotifier
- the notifier to be calledattachment
- the attachment to pass in to the notifier
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |