public abstract class ProviderFuture extends Object implements AsyncResult
Modifier and Type | Field and Description |
---|---|
protected static int |
COMPLETING |
protected ProviderException |
error |
protected static int |
FAILURE |
protected static int |
INCOMPLETE |
protected static AtomicIntegerFieldUpdater<ProviderFuture> |
STATE_FIELD_UPDATER |
protected static int |
SUCCESS |
protected ProviderSynchronization |
synchronization |
protected int |
waiting |
Constructor and Description |
---|
ProviderFuture() |
ProviderFuture(ProviderSynchronization synchronization) |
Modifier and Type | Method and Description |
---|---|
protected void |
failOnError() |
boolean |
isComplete()
Returns true if the AsyncResult has completed.
|
void |
onFailure(ProviderException result)
If the operation fails this method is invoked with the Exception
that caused the failure.
|
void |
onSuccess()
If the operation succeeds the resulting value produced is set to null and
the waiting parties are signaled.
|
abstract void |
sync()
Waits for a response to some Provider requested operation.
|
abstract boolean |
sync(long amount,
TimeUnit unit)
Timed wait for a response to a Provider operation.
|
protected final ProviderSynchronization synchronization
protected static final int INCOMPLETE
protected static final int COMPLETING
protected static final int SUCCESS
protected static final int FAILURE
protected static final AtomicIntegerFieldUpdater<ProviderFuture> STATE_FIELD_UPDATER
protected ProviderException error
protected int waiting
public ProviderFuture()
public ProviderFuture(ProviderSynchronization synchronization)
public boolean isComplete()
AsyncResult
isComplete
in interface AsyncResult
public void onFailure(ProviderException result)
AsyncResult
onFailure
in interface AsyncResult
result
- The error that resulted in this asynchronous operation failing.public void onSuccess()
AsyncResult
onSuccess
in interface AsyncResult
public abstract void sync() throws ProviderException
ProviderException
- if an error occurs while waiting for the response.public abstract boolean sync(long amount, TimeUnit unit) throws ProviderException
amount
- The amount of time to wait before abandoning the wait.unit
- The unit to use for this wait period.ProviderException
- if an error occurs while waiting for the response.protected void failOnError() throws ProviderException
ProviderException
Copyright © 2013–2021 The Apache Software Foundation. All rights reserved.