Package org.apache.qpid.jms.provider
Class ProviderFuture
- java.lang.Object
-
- org.apache.qpid.jms.provider.ProviderFuture
-
- All Implemented Interfaces:
AsyncResult
- Direct Known Subclasses:
BalancedProviderFuture,ConservativeProviderFuture,ProgressiveProviderFuture
public abstract class ProviderFuture extends Object implements AsyncResult
Asynchronous Provider Future class.
-
-
Field Summary
Fields Modifier and Type Field Description protected static intCOMPLETINGprotected ProviderExceptionerrorprotected static intFAILUREprotected static intINCOMPLETEprotected static AtomicIntegerFieldUpdater<ProviderFuture>STATE_FIELD_UPDATERprotected static intSUCCESSprotected ProviderSynchronizationsynchronizationprotected intwaiting
-
Constructor Summary
Constructors Constructor Description ProviderFuture()ProviderFuture(ProviderSynchronization synchronization)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidfailOnError()booleanisComplete()Returns true if the AsyncResult has completed.voidonFailure(ProviderException result)If the operation fails this method is invoked with the Exception that caused the failure.voidonSuccess()If the operation succeeds the resulting value produced is set to null and the waiting parties are signaled.abstract voidsync()Waits for a response to some Provider requested operation.abstract booleansync(long amount, TimeUnit unit)Timed wait for a response to a Provider operation.
-
-
-
Field Detail
-
synchronization
protected final ProviderSynchronization synchronization
-
INCOMPLETE
protected static final int INCOMPLETE
- See Also:
- Constant Field Values
-
COMPLETING
protected static final int COMPLETING
- See Also:
- Constant Field Values
-
SUCCESS
protected static final int SUCCESS
- See Also:
- Constant Field Values
-
FAILURE
protected static final int FAILURE
- See Also:
- Constant Field Values
-
STATE_FIELD_UPDATER
protected static final AtomicIntegerFieldUpdater<ProviderFuture> STATE_FIELD_UPDATER
-
error
protected ProviderException error
-
waiting
protected int waiting
-
-
Constructor Detail
-
ProviderFuture
public ProviderFuture()
-
ProviderFuture
public ProviderFuture(ProviderSynchronization synchronization)
-
-
Method Detail
-
isComplete
public boolean isComplete()
Description copied from interface:AsyncResultReturns true if the AsyncResult has completed. The task is considered complete regardless if it succeeded or failed.- Specified by:
isCompletein interfaceAsyncResult- Returns:
- returns true if the asynchronous operation has completed.
-
onFailure
public void onFailure(ProviderException result)
Description copied from interface:AsyncResultIf the operation fails this method is invoked with the Exception that caused the failure.- Specified by:
onFailurein interfaceAsyncResult- Parameters:
result- The error that resulted in this asynchronous operation failing.
-
onSuccess
public void onSuccess()
Description copied from interface:AsyncResultIf the operation succeeds the resulting value produced is set to null and the waiting parties are signaled.- Specified by:
onSuccessin interfaceAsyncResult
-
sync
public abstract void sync() throws ProviderExceptionWaits for a response to some Provider requested operation.- Throws:
ProviderException- if an error occurs while waiting for the response.
-
sync
public abstract boolean sync(long amount, TimeUnit unit) throws ProviderExceptionTimed wait for a response to a Provider operation.- Parameters:
amount- The amount of time to wait before abandoning the wait.unit- The unit to use for this wait period.- Returns:
- true if the operation succeeded and false if the waiting time elapsed while waiting for the operation to complete.
- Throws:
ProviderException- if an error occurs while waiting for the response.
-
failOnError
protected void failOnError() throws ProviderException- Throws:
ProviderException
-
-