Top Description Fields Constructors Methods
org.apache.commons.lang3.concurrent

public abstract Class AbstractFutureProxy<V>

extends Object
implements Future<V>
Class Inheritance
All Implemented Interfaces
java.util.concurrent.Future
Known Direct Subclasses
org.apache.commons.lang3.concurrent.UncheckedFutureImpl
Type Parameters
<V>
The result type returned by this Future's get() and get(long, TimeUnit) methods.
Imports
java.util.Objects, java.util.concurrent.ExecutionException, .Future, .TimeUnit, .TimeoutException

Proxies to a Future for subclassing.
Since
3.13.0

Field Summary

Modifier and TypeField and Description
private final Future<V>

Constructor Summary

AccessConstructor and Description
public
AbstractFutureProxy(final Future<V>
the delegate.
future
)

Constructs a new instance.

Method Summary

Modifier and TypeMethod and Description
public boolean
cancel(final boolean mayInterruptIfRunning)

Implements java.util.concurrent.Future.cancel.

Attempts to cancel execution of this task.

public V
get()

Implements java.util.concurrent.Future.get.

Waits if necessary for the computation to complete, and then retrieves its result.

public V
get(final long timeout, final TimeUnit unit)

Implements java.util.concurrent.Future.get.

Waits if necessary for at most the given time for the computation to complete, and then retrieves its result, if available.

public Future<V>

Returns:

the delegate.
getFuture
()

Gets the delegate.

public boolean
isCancelled()

Implements java.util.concurrent.Future.isCancelled.

Returns true if this task was cancelled before it completed normally.

public boolean
isDone()

Implements java.util.concurrent.Future.isDone.

Returns true if this task completed.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

futureback to summary
private final Future<V> future

Constructor Detail

AbstractFutureProxyback to summary
public AbstractFutureProxy(final Future<V> future)

Constructs a new instance.

Parameters
future:Future<V>

the delegate.

Method Detail

cancelback to summary
public boolean cancel(final boolean mayInterruptIfRunning)

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

Annotations
@Override
getback to summary
public V get() throws InterruptedException, ExecutionException

Implements java.util.concurrent.Future.get.

Doc from java.util.concurrent.Future.get.

Waits if necessary for the computation to complete, and then retrieves its result.

Annotations
@Override
Exceptions
InterruptedException:
if the current thread was interrupted while waiting
ExecutionException:
if the computation threw an exception
getback to summary
public V get(final long timeout, final TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException

Implements java.util.concurrent.Future.get.

Doc from java.util.concurrent.Future.get.

Waits if necessary for at most the given time for the computation to complete, and then retrieves its result, if available.

Annotations
@Override
Exceptions
InterruptedException:
if the current thread was interrupted while waiting
ExecutionException:
if the computation threw an exception
TimeoutException:
if the wait timed out
getFutureback to summary
public Future<V> getFuture()

Gets the delegate.

Returns:Future<V>

the delegate.

isCancelledback to summary
public boolean isCancelled()

Implements java.util.concurrent.Future.isCancelled.

Doc from java.util.concurrent.Future.isCancelled.

Returns true if this task was cancelled before it completed normally.

Annotations
@Override
isDoneback to summary
public boolean isDone()

Implements java.util.concurrent.Future.isDone.

Doc from java.util.concurrent.Future.isDone.

Returns true if this task completed. Completion may be due to normal termination, an exception, or cancellation -- in all of these cases, this method will return true.

Annotations
@Override