Class FailoverProvider.FailoverRequest
- java.lang.Object
-
- org.apache.qpid.jms.provider.WrappedAsyncResult
-
- org.apache.qpid.jms.provider.failover.FailoverProvider.FailoverRequest
-
- All Implemented Interfaces:
Runnable,AsyncResult
- Direct Known Subclasses:
FailoverProvider.CreateConnectionRequest
- Enclosing class:
- FailoverProvider
protected abstract class FailoverProvider.FailoverRequest extends WrappedAsyncResult implements Runnable
For all requests that are dispatched from the FailoverProvider to a connected Provider instance an instance of FailoverRequest is used to handle errors that occur during processing of that request and trigger a reconnect.
-
-
Field Summary
Fields Modifier and Type Field Description protected ProvideractiveProviderprotected longid
-
Constructor Summary
Constructors Constructor Description FailoverRequest(AsyncResult watcher)FailoverRequest(AsyncResult watcher, long requestTimeout)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected ProviderExceptioncreateOfflineFailureException(ProviderException error)protected ProviderExceptioncreateTimedOutException()abstract voiddoTask(Provider provider)Called to execute the specific task that was requested.booleanfailureWhenOffline()When the transport is not connected should this request automatically fail.booleanisExpired()voidonFailure(ProviderException error)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.voidrun()booleansucceedsWhenOffline()Should the request just succeed when the Provider is not connected.-
Methods inherited from class org.apache.qpid.jms.provider.WrappedAsyncResult
getWrappedRequest, isComplete
-
-
-
-
Field Detail
-
id
protected final long id
-
activeProvider
protected Provider activeProvider
-
-
Constructor Detail
-
FailoverRequest
public FailoverRequest(AsyncResult watcher)
-
FailoverRequest
public FailoverRequest(AsyncResult watcher, long requestTimeout)
-
-
Method Detail
-
onFailure
public void onFailure(ProviderException error)
Description copied from interface:AsyncResultIf the operation fails this method is invoked with the Exception that caused the failure.- Specified by:
onFailurein interfaceAsyncResult- Overrides:
onFailurein classWrappedAsyncResult- Parameters:
error- 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- Overrides:
onSuccessin classWrappedAsyncResult
-
doTask
public abstract void doTask(Provider provider) throws ProviderException
Called to execute the specific task that was requested.- Parameters:
provider- The provider instance to use when performing this action.- Throws:
ProviderException- if an error occurs during task execution.
-
succeedsWhenOffline
public boolean succeedsWhenOffline()
Should the request just succeed when the Provider is not connected.- Returns:
- true if the request is marked as successful when not connected.
-
failureWhenOffline
public boolean failureWhenOffline()
When the transport is not connected should this request automatically fail.- Returns:
- true if the task should fail when the Provider is not connected.
-
isExpired
public boolean isExpired()
- Returns:
- true if the request has a configured expiration time.
-
createTimedOutException
protected ProviderException createTimedOutException()
-
createOfflineFailureException
protected ProviderException createOfflineFailureException(ProviderException error)
-
-