Interface RetryingCallable<T>

Type Parameters:
T - result class from executing this
All Known Implementing Classes:
CancellableRegionServerCallable, ClientServiceCallable, FlushRegionCallable, MasterCallable, MultiServerCallable, NoncedRegionServerCallable, RegionAdminServiceCallable, RegionReplicaReplicationEndpoint.RegionReplicaReplayCallable, RegionServerCallable, ReversedScannerCallable, RpcRetryingCallable, RpcRetryingCallerWithReadReplicas.ReplicaRegionServerCallable, ScannerCallable, ScannerCallableWithReplicas, ScannerCallableWithReplicas.RetryingRPC

@Private public interface RetryingCallable<T>
A Callable<T> that will be retried. If call(int) invocation throws exceptions, we will call throwable(Throwable, boolean) with whatever the exception was.
  • Method Summary

    Modifier and Type
    Method
    Description
    call(int callTimeout)
    Computes a result, or throws an exception if unable to do so.
    Returns Some details from the implementation that we would like to add to a terminating exception; i.e.
    void
    prepare(boolean reload)
    Prepare by setting up any connections to servers, etc., ahead of call invocation.
    long
    sleep(long pause, int tries)
    Sleep and retry.
    void
    throwable(Throwable t, boolean retrying)
    Called when call throws an exception and we are going to retry; take action to make it so we succeed on next call (clear caches, do relookup of locations, etc.).
  • Method Details

    • prepare

      void prepare(boolean reload) throws IOException
      Prepare by setting up any connections to servers, etc., ahead of call invocation. TODO: We call prepare before EVERY call. Seems wrong. FIX!!!!
      Parameters:
      reload - Set this to true if need to requery locations
      Throws:
      IOException - e
    • throwable

      void throwable(Throwable t, boolean retrying)
      Called when call throws an exception and we are going to retry; take action to make it so we succeed on next call (clear caches, do relookup of locations, etc.).
      Parameters:
      t - throwable which was thrown
      retrying - True if we are in retrying mode (we are not in retrying mode when max retries == 1; we ARE in retrying mode if retries > 1 even when we are the last attempt)
    • getExceptionMessageAdditionalDetail

      Returns Some details from the implementation that we would like to add to a terminating exception; i.e. a fatal exception is being thrown ending retries and we might like to add more implementation-specific detail on to the exception being thrown.
    • sleep

      long sleep(long pause, int tries)
      Sleep and retry.
      Parameters:
      pause - time to pause
      tries - amount of tries until till sleep
      Returns:
      Suggestion on how much to sleep between retries
    • call

      T call(int callTimeout) throws Exception
      Computes a result, or throws an exception if unable to do so.
      Parameters:
      callTimeout - - the time available for this call. 0 for infinite.
      Returns:
      computed result
      Throws:
      Exception - if unable to compute a result