Package org.xnio
Class AbstractConvertingIoFuture<T,D>
java.lang.Object
org.xnio.AbstractConvertingIoFuture<T,D>
- Type Parameters:
T- the type of this future resultD- the type of the delegate result
- All Implemented Interfaces:
Cancellable,IoFuture<T>
An
IoFuture implementation that wraps a different type of IoFuture. Used to create general wrappers
that convert one channel type to another.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.xnio.IoFuture
IoFuture.HandlingNotifier<T,A>, IoFuture.Notifier<T, A>, IoFuture.Status -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractConvertingIoFuture(IoFuture<? extends D> delegate) -
Method Summary
Modifier and TypeMethodDescriptionaddNotifier(IoFuture.Notifier<? super T, A> notifier, A attachment) Add a notifier to be called when this operation is complete.await()Wait for the operation to complete.Wait for the operation to complete, with a timeout.Wait for the operation to complete.awaitInterruptibly(long time, TimeUnit timeUnit) Wait for the operation to complete, with a timeout.cancel()Cancel an operation.protected abstract Tget()Get the result of the operation.Get the failure reason.Get the result of the operation.Get the current status.
-
Field Details
-
delegate
The delegate future result.
-
-
Constructor Details
-
AbstractConvertingIoFuture
-
-
Method Details
-
getDelegate
-
cancel
Description copied from interface:IoFutureCancel an operation. The actual cancel may be synchronous or asynchronous.- Specified by:
cancelin interfaceCancellable- Specified by:
cancelin interfaceIoFuture<T>- Returns:
- this instance
-
getStatus
Description copied from interface:IoFutureGet the current status. -
await
Description copied from interface:IoFutureWait for the operation to complete. This method will block until the status changes fromIoFuture.Status.WAITING. -
await
Description copied from interface:IoFutureWait for the operation to complete, with a timeout. This method will block until the status changes fromIoFuture.Status.WAITING, or the given time elapses. If the time elapses before the operation is complete,IoFuture.Status.WAITINGis returned.- Specified by:
awaitin interfaceIoFuture<T>- Parameters:
time- the amount of time to waittimeUnit- the time unit- Returns:
- the new status, or
IoFuture.Status.WAITINGif the timeout expired
-
awaitInterruptibly
Description copied from interface:IoFutureWait for the operation to complete. This method will block until the status changes fromIoFuture.Status.WAITING, or the current thread is interrupted.- Specified by:
awaitInterruptiblyin interfaceIoFuture<T>- Returns:
- the new status
- Throws:
InterruptedException- if the operation is interrupted
-
awaitInterruptibly
Description copied from interface:IoFutureWait for the operation to complete, with a timeout. This method will block until the status changes fromIoFuture.Status.WAITING, the given time elapses, or the current thread is interrupted. If the time elapses before the operation is complete,IoFuture.Status.WAITINGis returned.- Specified by:
awaitInterruptiblyin interfaceIoFuture<T>- Parameters:
time- the amount of time to waittimeUnit- the time unit- Returns:
- the new status, or
IoFuture.Status.WAITINGif the timeout expired - Throws:
InterruptedException- if the operation is interrupted
-
getException
Description copied from interface:IoFutureGet the failure reason.- Specified by:
getExceptionin interfaceIoFuture<T>- Returns:
- the failure reason
- Throws:
IllegalStateException- if the operation did not fail
-
get
Description copied from interface:IoFutureGet the result of the operation. If the operation is not complete, blocks until the operation completes. If the operation fails, or has already failed at the time this method is called, the failure reason is thrown.- Specified by:
getin interfaceIoFuture<T>- Returns:
- the result of the operation
- Throws:
IOException- if the operation failed
-
getInterruptibly
Description copied from interface:IoFutureGet the result of the operation. If the operation is not complete, blocks until the operation completes. If the operation fails, or has already failed at the time this method is called, the failure reason is thrown. If the current thread is interrupted while waiting, an exception is thrown.- Specified by:
getInterruptiblyin interfaceIoFuture<T>- Returns:
- the result of the operation
- Throws:
IOException- if the operation failedInterruptedException- if the operation is interrupted
-
convert
- Throws:
IOException
-
addNotifier
Description copied from interface:IoFutureAdd a notifier to be called when this operation is complete. If the operation is already complete, the notifier is called immediately, possibly in the caller's thread. The given attachment is provided to the notifier.- Specified by:
addNotifierin interfaceIoFuture<T>- Type Parameters:
A- the attachment type- Parameters:
notifier- the notifier to be calledattachment- the attachment to pass in to the notifier- Returns:
- this instance
-