Top Description Inners Fields Constructors Methods
org.xnio

public abstract Class AbstractIoFuture<T>

extends Object
implements IoFuture<T>
Class Inheritance
All Implemented Interfaces
org.xnio.IoFuture, org.xnio.Cancellable
Known Direct Subclasses
org.xnio.FailedIoFuture
Type Parameters
<T>
the type of result that this operation produces
Imports
java.io.IOException, java.util.concurrent.TimeUnit, .CancellationException, .Executor, java.util.concurrent.atomic.AtomicReference, java.util.concurrent.locks.LockSupport

An abstract base class for IoFuture objects. Used to easily produce implementations.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
pack-priv static class
pack-priv static class
pack-priv static class
pack-priv static class
pack-priv static class
pack-priv static class
pack-priv static class
pack-priv abstract static class
pack-priv static class

Field Summary

Modifier and TypeField and Description
private static final AbstractIoFuture.State<?>
private static final AbstractIoFuture.State<?>
private final AtomicReference<AbstractIoFuture.State<T>>

Constructor Summary

AccessConstructor and Description
protected
AbstractIoFuture()

Construct a new instance.

Method Summary

Modifier and TypeMethod and Description
protected void
addCancelHandler(final Cancellable
the cancel handler
cancellable
)

Add a cancellation handler.

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(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(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 IoFuture instance
cancel
()

Implements org.xnio.IoFuture.cancel.

Cancel an operation.

private boolean
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.

protected Executor

Returns:

the executor to use
getNotifierExecutor
()

Get the executor used to run asynchronous notifiers.

private AbstractIoFuture.State<T>
public IoFuture.Status
getStatus()

Implements org.xnio.IoFuture.getStatus.

Get the current status.

protected void
runNotifier(final Runnable
the runnable task
runnable
)

Run a notifier.

protected boolean

Returns:

false if the operation was already completed, true otherwise
setCancelled
()

Acknowledge the cancellation of this operation.

protected boolean

Returns:

false if the operation was already completed, true otherwise
setException
(IOException
the exception to set
exception
)

Set the exception for this operation.

protected boolean

Returns:

false if the operation was already completed, true otherwise
setResult
(T
the result to set
result
)

Set the result for this operation.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait