Top Description Fields Constructors Methods
org.xnio

public Class FinishedIoFuture<T>

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

An implementation of IoFuture that represents an immediately-successful operation.

Field Summary

Modifier and TypeField and Description
private final T

Constructor Summary

AccessConstructor and Description
public
FinishedIoFuture(T
the operation result
result
)

Create an instance.

Method Summary

Modifier and TypeMethod and Description
public <A> IoFuture<T>
addNotifier(final IoFuture.Notifier<? super T, A>
the notifier to be called
notifier
,
final 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>

Returns:

this instance
cancel
()

Implements org.xnio.IoFuture.cancel.

Cancel the operation.

public T
get()

Implements org.xnio.IoFuture.get.

Get the result of the operation.

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

resultback to summary
private final T result

Constructor Detail

FinishedIoFutureback to summary
public FinishedIoFuture(T result)

Create an instance.

Parameters
result:T

the operation result

Method Detail

addNotifierback to summary
public <A> IoFuture<T> addNotifier(final IoFuture.Notifier<? super T, A> notifier, final 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

Annotations
@Override
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

Annotations
@Override
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

Annotations
@Override
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

Annotations
@Override
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

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

Implements org.xnio.IoFuture.cancel.

Cancel the operation. Since this operation is always complete, this is a no-op.

Returns:IoFuture<T>

this instance

getback to summary
public T get() throws IOException, CancellationException

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

Annotations
@Override
Exceptions
IOException:
if the operation failed
CancellationException:
if the operation was cancelled
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

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

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

Annotations
@Override
Exceptions
IOException:
if the operation failed
InterruptedException:
if the operation is interrupted
CancellationException:
if the operation was cancelled
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

Annotations
@Override