Top Description Fields Constructors Methods
org.xnio

public abstract Class AbstractConvertingIoFuture<T, D>

extends Object
implements IoFuture<T>
Class Inheritance
All Implemented Interfaces
org.xnio.IoFuture, org.xnio.Cancellable
Type Parameters
<T>
the type of this future result
<D>
the type of the delegate result
Imports
java.util.concurrent.TimeUnit, java.io.IOException

An IoFuture implementation that wraps a different type of IoFuture. Used to create general wrappers that convert one channel type to another.

Field Summary

Modifier and TypeField and Description
protected final IoFuture<? extends D>
delegate

The delegate future result.

Constructor Summary

AccessConstructor and Description
protected
AbstractConvertingIoFuture(final IoFuture<? extends D> delegate)

Method Summary

Modifier and TypeMethod and Description
public <A> IoFuture<T>
addNotifier(final IoFuture.Notifier<? super T, A>
the notifier to be called
notifier
,
A
the attachment to pass in to the notifier
attachment
)

Implements org.xnio.IoFuture.addNotifier.

Add a notifier to be called when this operation is complete.

public IoFuture.Status
await()

Implements org.xnio.IoFuture.await.

Wait for the operation to complete.

public IoFuture.Status
await(final long
the amount of time to wait
time
,
final TimeUnit
the time unit
timeUnit
)

Implements org.xnio.IoFuture.await.

Wait for the operation to complete, with a timeout.

public IoFuture.Status
awaitInterruptibly()

Implements org.xnio.IoFuture.awaitInterruptibly.

Wait for the operation to complete.

public IoFuture.Status
awaitInterruptibly(final long
the amount of time to wait
time
,
final TimeUnit
the time unit
timeUnit
)

Implements org.xnio.IoFuture.awaitInterruptibly.

Wait for the operation to complete, with a timeout.

public IoFuture<T>
cancel()

Implements org.xnio.IoFuture.cancel.

Cancel an operation.

protected abstract T
convert(D arg)

public T
get()

Implements org.xnio.IoFuture.get.

Get the result of the operation.

protected IoFuture<? extends D>
public IOException
getException()

Implements org.xnio.IoFuture.getException.

Get the failure reason.

public T
getInterruptibly()

Implements org.xnio.IoFuture.getInterruptibly.

Get the result of the operation.

public IoFuture.Status
getStatus()

Implements org.xnio.IoFuture.getStatus.

Get the current status.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

delegateback to summary
protected final IoFuture<? extends D> delegate

The delegate future result.

Constructor Detail

AbstractConvertingIoFutureback to summary
protected AbstractConvertingIoFuture(final IoFuture<? extends D> delegate)

Method Detail

addNotifierback to summary
public <A> IoFuture<T> addNotifier(final IoFuture.Notifier<? super T, A> notifier, A attachment)

Implements org.xnio.IoFuture.addNotifier.

Doc from org.xnio.IoFuture.addNotifier.

Add 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.

Parameters
<A>
the attachment type
notifier:IoFuture.Notifier<? super T, A>

the notifier to be called

attachment:A

the attachment to pass in to the notifier

Returns:IoFuture<T>

this instance

awaitback to summary
public IoFuture.Status await()

Implements org.xnio.IoFuture.await.

Doc from org.xnio.IoFuture.await.

Wait for the operation to complete. This method will block until the status changes from Status#WAITING.

Returns:IoFuture.Status

the new status

awaitback to summary
public IoFuture.Status await(final long time, final TimeUnit timeUnit)

Implements org.xnio.IoFuture.await.

Doc from org.xnio.IoFuture.await.

Wait for the operation to complete, with a timeout. This method will block until the status changes from Status#WAITING, or the given time elapses. If the time elapses before the operation is complete, Status#WAITING is returned.

Parameters
time:long

the amount of time to wait

timeUnit:TimeUnit

the time unit

Returns:IoFuture.Status

the new status, or Status#WAITING if the timeout expired

awaitInterruptiblyback to summary
public IoFuture.Status awaitInterruptibly() throws InterruptedException

Implements org.xnio.IoFuture.awaitInterruptibly.

Doc from org.xnio.IoFuture.awaitInterruptibly.

Wait for the operation to complete. This method will block until the status changes from Status#WAITING, or the current thread is interrupted.

Returns:IoFuture.Status

the new status

Exceptions
InterruptedException:
if the operation is interrupted
awaitInterruptiblyback to summary
public IoFuture.Status awaitInterruptibly(final long time, final TimeUnit timeUnit) throws InterruptedException

Implements org.xnio.IoFuture.awaitInterruptibly.

Doc from org.xnio.IoFuture.awaitInterruptibly.

Wait for the operation to complete, with a timeout. This method will block until the status changes from Status#WAITING, the given time elapses, or the current thread is interrupted. If the time elapses before the operation is complete, Status#WAITING is returned.

Parameters
time:long

the amount of time to wait

timeUnit:TimeUnit

the time unit

Returns:IoFuture.Status

the new status, or Status#WAITING if the timeout expired

Exceptions
InterruptedException:
if the operation is interrupted
cancelback to summary
public IoFuture<T> cancel()

Implements org.xnio.IoFuture.cancel.

Doc from org.xnio.IoFuture.cancel.

Cancel an operation. The actual cancel may be synchronous or asynchronous.

Returns:IoFuture<T>

Doc from org.xnio.Cancellable.cancel.

this instance

convertback to summary
protected abstract T convert(D arg) throws IOException
getback to summary
public T get() throws IOException

Implements org.xnio.IoFuture.get.

Doc from org.xnio.IoFuture.get.

Get 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.

Returns:T

the result of the operation

Exceptions
IOException:
if the operation failed
getDelegateback to summary
protected IoFuture<? extends D> getDelegate()
getExceptionback to summary
public IOException getException() throws IllegalStateException

Implements org.xnio.IoFuture.getException.

Doc from org.xnio.IoFuture.getException.

Get the failure reason.

Returns:IOException

the failure reason

Exceptions
IllegalStateException:
if the operation did not fail
getInterruptiblyback to summary
public T getInterruptibly() throws IOException, InterruptedException

Implements org.xnio.IoFuture.getInterruptibly.

Doc from org.xnio.IoFuture.getInterruptibly.

Get 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.

Returns:T

the result of the operation

Exceptions
IOException:
if the operation failed
InterruptedException:
if the operation is interrupted
getStatusback to summary
public IoFuture.Status getStatus()

Implements org.xnio.IoFuture.getStatus.

Doc from org.xnio.IoFuture.getStatus.

Get the current status.

Returns:IoFuture.Status

the current status