Class FailoverProvider.FailoverRequest

  • All Implemented Interfaces:
    java.lang.Runnable, AsyncResult
    Direct Known Subclasses:
    FailoverProvider.CreateConnectionRequest
    Enclosing class:
    FailoverProvider

    protected abstract class FailoverProvider.FailoverRequest
    extends WrappedAsyncResult
    implements java.lang.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 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

      • run

        public void run()
        Specified by:
        run in interface java.lang.Runnable
      • onFailure

        public void onFailure​(ProviderException error)
        Description copied from interface: AsyncResult
        If the operation fails this method is invoked with the Exception that caused the failure.
        Specified by:
        onFailure in interface AsyncResult
        Overrides:
        onFailure in class WrappedAsyncResult
        Parameters:
        error - The error that resulted in this asynchronous operation failing.
      • onSuccess

        public void onSuccess()
        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:
        onSuccess in interface AsyncResult
        Overrides:
        onSuccess in class WrappedAsyncResult
      • 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.