Top Description Fields Constructors Methods
org.apache.hc.core5.concurrent

public final Class ComplexFuture<T>

extends BasicFuture<T>
implements CancellableDependency
Class Inheritance
All Implemented Interfaces
org.apache.hc.core5.concurrent.CancellableDependency, org.apache.hc.core5.concurrent.Cancellable
Type Parameters
<T>
the future result type of an asynchronous operation.
Imports
java.util.concurrent.Future, java.util.concurrent.atomic.AtomicReference, org.apache.hc.core5.util.Args

Future whose result depends on another Cancellable process or operation or another Future. Dependent process will get cancelled if the future itself is cancelled.
Since
5.0

Field Summary

Modifier and TypeField and Description
private final AtomicReference<Cancellable>

Constructor Summary

AccessConstructor and Description
public
ComplexFuture(final FutureCallback<T> callback)

Method Summary

Modifier and TypeMethod and Description
public boolean
cancel(final 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
)

Overrides org.apache.hc.core5.concurrent.BasicFuture.cancel.

Implements java.util.concurrent.Future.cancel.

Attempts to cancel execution of this task.
public boolean
public boolean
public void
setDependency(final Cancellable dependency)

Implements org.apache.hc.core5.concurrent.CancellableDependency.setDependency.

Sets Cancellable dependency on another ongoing process or operation represented by Cancellable.
public void
setDependency(final Future<?> dependency)

Inherited from org.apache.hc.core5.concurrent.BasicFuture:
cancelgetgetisCancelledisDone

Field Detail

dependencyRefback to summary
private final AtomicReference<Cancellable> dependencyRef

Constructor Detail

ComplexFutureback to summary
public ComplexFuture(final FutureCallback<T> callback)

Method Detail

cancelback to summary
public boolean cancel(final boolean mayInterruptIfRunning)

Overrides org.apache.hc.core5.concurrent.BasicFuture.cancel.

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.

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
completedback to summary
public boolean completed(final T result)

Overrides org.apache.hc.core5.concurrent.BasicFuture.completed.

Annotations
@Override
failedback to summary
public boolean failed(final Exception exception)

Overrides org.apache.hc.core5.concurrent.BasicFuture.failed.

Annotations
@Override
setDependencyback to summary
public void setDependency(final Cancellable dependency)

Implements org.apache.hc.core5.concurrent.CancellableDependency.setDependency.

Doc from org.apache.hc.core5.concurrent.CancellableDependency.setDependency.

Sets Cancellable dependency on another ongoing process or operation represented by Cancellable.

Annotations
@Override
setDependencyback to summary
public void setDependency(final Future<?> dependency)