Top Description Methods
io.netty.util.concurrent

public Interface Future<V>

extends Future<V>
Known Direct Subinterfaces
io.netty.util.concurrent.ProgressiveFuture, io.netty.util.concurrent.Promise, io.netty.util.concurrent.ScheduledFuture
Known Direct Implementers
io.netty.util.concurrent.AbstractFuture
Annotations
@SuppressWarnings:ClassNameSameAsAncestorName
Imports
java.util.concurrent.CancellationException, .TimeUnit

The result of an asynchronous operation.

Method Summary

Modifier and TypeMethod and Description
public Future<V>
addListener(GenericFutureListener<? extends Future<? super V>> listener)

Adds the specified listener to this future.

public Future<V>
addListeners(GenericFutureListener<? extends Future<? super V>>... listeners)

Adds the specified listeners to this future.

public Future<V>
await()

Waits for this future to be completed.

public boolean

Returns:

true if and only if the future was completed within the specified time limit
await
(long timeout, TimeUnit unit)

Waits for this future to be completed within the specified time limit.

public boolean

Returns:

true if and only if the future was completed within the specified time limit
await
(long timeoutMillis)

Waits for this future to be completed within the specified time limit.

public Future<V>
awaitUninterruptibly()

Waits for this future to be completed without interruption.

public boolean

Returns:

true if and only if the future was completed within the specified time limit
awaitUninterruptibly
(long timeout, TimeUnit unit)

Waits for this future to be completed within the specified time limit without interruption.

public boolean

Returns:

true if and only if the future was completed within the specified time limit
awaitUninterruptibly
(long timeoutMillis)

Waits for this future to be completed within the specified time limit without interruption.

public boolean
cancel(boolean
true if the thread executing this task should be interrupted (if the thread is known to the implementation); otherwise, in-progress tasks are allowed to complete
mayInterruptIfRunning
)

Redeclares java.util.concurrent.Future.cancel.

Attempts to cancel execution of this task.
public Throwable

Returns:

the cause of the failure. null if succeeded or this future is not completed yet.
cause
()

Returns the cause of the failed I/O operation if the I/O operation has failed.

public V
getNow()

Return the result without blocking.

public boolean
isCancellable()

returns true if and only if the operation can be cancelled via cancel(boolean).

public boolean
isSuccess()

Returns true if and only if the I/O operation was completed successfully.

public Future<V>
removeListener(GenericFutureListener<? extends Future<? super V>> listener)

Removes the first occurrence of the specified listener from this future.

public Future<V>
removeListeners(GenericFutureListener<? extends Future<? super V>>... listeners)

Removes the first occurrence for each of the listeners from this future.

public Future<V>
sync()

Waits for this future until it is done, and rethrows the cause of the failure if this future failed.

public Future<V>
syncUninterruptibly()

Waits for this future until it is done, and rethrows the cause of the failure if this future failed.

Inherited from java.util.concurrent.Future:
exceptionNowgetgetisCancelledisDoneresultNowstate

Method Detail

addListenerback to summary
public Future<V> addListener(GenericFutureListener<? extends Future<? super V>> listener)

Adds the specified listener to this future. The specified listener is notified when this future is done. If this future is already completed, the specified listener is notified immediately.

addListenersback to summary
public Future<V> addListeners(GenericFutureListener<? extends Future<? super V>>... listeners)

Adds the specified listeners to this future. The specified listeners are notified when this future is done. If this future is already completed, the specified listeners are notified immediately.

awaitback to summary
public Future<V> await() throws InterruptedException

Waits for this future to be completed.

Exceptions
InterruptedException:
if the current thread was interrupted
awaitback to summary
public boolean await(long timeout, TimeUnit unit) throws InterruptedException

Waits for this future to be completed within the specified time limit.

Returns:boolean

true if and only if the future was completed within the specified time limit

Exceptions
InterruptedException:
if the current thread was interrupted
awaitback to summary
public boolean await(long timeoutMillis) throws InterruptedException

Waits for this future to be completed within the specified time limit.

Returns:boolean

true if and only if the future was completed within the specified time limit

Exceptions
InterruptedException:
if the current thread was interrupted
awaitUninterruptiblyback to summary
public Future<V> awaitUninterruptibly()

Waits for this future to be completed without interruption. This method catches an InterruptedException and discards it silently.

awaitUninterruptiblyback to summary
public boolean awaitUninterruptibly(long timeout, TimeUnit unit)

Waits for this future to be completed within the specified time limit without interruption. This method catches an InterruptedException and discards it silently.

Returns:boolean

true if and only if the future was completed within the specified time limit

awaitUninterruptiblyback to summary
public boolean awaitUninterruptibly(long timeoutMillis)

Waits for this future to be completed within the specified time limit without interruption. This method catches an InterruptedException and discards it silently.

Returns:boolean

true if and only if the future was completed within the specified time limit

cancelback to summary
public boolean cancel(boolean mayInterruptIfRunning)

Redeclares java.util.concurrent.Future.cancel.

Doc from java.util.concurrent.Future.cancel.

Attempts to cancel execution of this task. This method has no effect if the task is already completed or cancelled, or could not be cancelled for some other reason. Otherwise, if this task has not started when cancel is called, this task should never run. If the task has already started, then the mayInterruptIfRunning parameter determines whether the thread executing this task (when known by the implementation) is interrupted in an attempt to stop the task.

The return value from this method does not necessarily indicate whether the task is now cancelled; use isCancelled. If the cancellation was successful it will fail the future with a CancellationException.

Parameters
mayInterruptIfRunning:boolean

true if the thread executing this task should be interrupted (if the thread is known to the implementation); otherwise, in-progress tasks are allowed to complete

Returns:boolean

false if the task could not be cancelled, typically because it has already completed; true otherwise. If two or more threads cause a task to be cancelled, then at least one of them returns true. Implementations may provide stronger guarantees.

Annotations
@Override
causeback to summary
public Throwable cause()

Returns the cause of the failed I/O operation if the I/O operation has failed.

Returns:Throwable

the cause of the failure. null if succeeded or this future is not completed yet.

getNowback to summary
public V getNow()

Return the result without blocking. If the future is not done yet this will return null. As it is possible that a null value is used to mark the future as successful you also need to check if the future is really done with isDone() and not rely on the returned null value.

isCancellableback to summary
public boolean isCancellable()

returns true if and only if the operation can be cancelled via cancel(boolean).

isSuccessback to summary
public boolean isSuccess()

Returns true if and only if the I/O operation was completed successfully.

removeListenerback to summary
public Future<V> removeListener(GenericFutureListener<? extends Future<? super V>> listener)

Removes the first occurrence of the specified listener from this future. The specified listener is no longer notified when this future is done. If the specified listener is not associated with this future, this method does nothing and returns silently.

removeListenersback to summary
public Future<V> removeListeners(GenericFutureListener<? extends Future<? super V>>... listeners)

Removes the first occurrence for each of the listeners from this future. The specified listeners are no longer notified when this future is done. If the specified listeners are not associated with this future, this method does nothing and returns silently.

syncback to summary
public Future<V> sync() throws InterruptedException

Waits for this future until it is done, and rethrows the cause of the failure if this future failed.

syncUninterruptiblyback to summary
public Future<V> syncUninterruptibly()

Waits for this future until it is done, and rethrows the cause of the failure if this future failed.