Class ClientFuture<V>
java.lang.Object
org.apache.qpid.protonj2.client.futures.ClientFuture<V>
- Type Parameters:
V
- the eventual result type for this Future
- All Implemented Interfaces:
Future<V>
,AsyncResult<V>
- Direct Known Subclasses:
BalancedClientFuture
,ConservativeClientFuture
,ProgressiveClientFuture
Asynchronous Client Future class.
-
Field Summary
Modifier and TypeFieldDescriptionprotected static final int
protected static final int
protected ExecutionException
protected static final int
protected static final int
protected V
protected static final AtomicIntegerFieldUpdater<ClientFuture>
protected static final int
protected final ClientSynchronization<V>
protected int
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
cancel
(boolean mayInterruptIfRunning) void
If the operation succeeds the resulting value produced is set to null and the waiting parties are signaled.void
failed
(ClientException result) If the operation fails this method is invoked with the Exception that caused the failure.abstract V
get()
abstract V
protected int
getState()
boolean
boolean
Returns true if the AsyncResult has completed.boolean
isDone()
boolean
isFailed()
protected boolean
protected void
TODO - Provide hook to run on the event loop to do whatever it means to cancel this task and update the task state in a thread safe manner.
-
Field Details
-
synchronization
-
INCOMPLETE
protected static final int INCOMPLETE- See Also:
-
COMPLETING
protected static final int COMPLETING- See Also:
-
SUCCESS
protected static final int SUCCESS- See Also:
-
FAILURE
protected static final int FAILURE- See Also:
-
CANCELLED
protected static final int CANCELLED- See Also:
-
STATE_FIELD_UPDATER
-
error
-
waiting
protected int waiting -
result
-
-
Constructor Details
-
ClientFuture
-
-
Method Details
-
cancel
public boolean cancel(boolean mayInterruptIfRunning) -
isFailed
public boolean isFailed()- Returns:
- true if the
Future
operation failed.
-
getResult
- Returns:
- the resulting value of the operation upon successful completion.
-
isCancelled
public boolean isCancelled()- Specified by:
isCancelled
in interfaceFuture<V>
-
isDone
public boolean isDone() -
isComplete
public boolean isComplete()Description copied from interface:AsyncResult
Returns true if the AsyncResult has completed. The task is considered complete regardless if it succeeded or failed.- Specified by:
isComplete
in interfaceAsyncResult<V>
- Returns:
- returns true if the asynchronous operation has completed.
-
isNotComplete
protected boolean isNotComplete() -
getState
protected int getState()- Returns:
- the current
ClientFuture
state as if this call.
-
failed
Description copied from interface:AsyncResult
If the operation fails this method is invoked with the Exception that caused the failure.- Specified by:
failed
in interfaceAsyncResult<V>
- Parameters:
result
- The error that resulted in this asynchronous operation failing.
-
complete
Description copied from interface:AsyncResult
If the operation succeeds the resulting value produced is set to null and the waiting parties are signaled.- Specified by:
complete
in interfaceAsyncResult<V>
- Parameters:
result
- the object that completes the future.
-
get
- Specified by:
get
in interfaceFuture<V>
- Throws:
InterruptedException
ExecutionException
-
get
public abstract V get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException - Specified by:
get
in interfaceFuture<V>
- Throws:
InterruptedException
ExecutionException
TimeoutException
-
tryCancelTask
protected void tryCancelTask()TODO - Provide hook to run on the event loop to do whatever it means to cancel this task and update the task state in a thread safe manner.
-