Class RpcRetryingCallable<V>

java.lang.Object
org.apache.hadoop.hbase.client.RpcRetryingCallable<V>
Type Parameters:
V - return type
All Implemented Interfaces:
Closeable, AutoCloseable, RetryingCallable<V>

abstract class RpcRetryingCallable<V> extends Object implements RetryingCallable<V>, Closeable
A RetryingCallable for RPC connection operations.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    call(int callTimeout)
    Computes a result, or throws an exception if unable to do so.
    void
     
    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.
    protected abstract V
    rpcCall(int callTimeout)
     
    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.).

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • prepare

      public void prepare(boolean reload) throws IOException
      Description copied from interface: RetryingCallable
      Prepare by setting up any connections to servers, etc., ahead of call invocation. TODO: We call prepare before EVERY call. Seems wrong. FIX!!!!
      Specified by:
      prepare in interface RetryingCallable<V>
      Parameters:
      reload - Set this to true if need to requery locations
      Throws:
      IOException - e
    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Throws:
      IOException
    • throwable

      public void throwable(Throwable t, boolean retrying)
      Description copied from interface: RetryingCallable
      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.).
      Specified by:
      throwable in interface RetryingCallable<V>
      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

      Description copied from interface: RetryingCallable
      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.
      Specified by:
      getExceptionMessageAdditionalDetail in interface RetryingCallable<V>
    • sleep

      public long sleep(long pause, int tries)
      Description copied from interface: RetryingCallable
      Sleep and retry.
      Specified by:
      sleep in interface RetryingCallable<V>
      Parameters:
      pause - time to pause
      tries - amount of tries until till sleep
      Returns:
      Suggestion on how much to sleep between retries
    • call

      public V call(int callTimeout) throws IOException
      Description copied from interface: RetryingCallable
      Computes a result, or throws an exception if unable to do so.
      Specified by:
      call in interface RetryingCallable<V>
      Parameters:
      callTimeout - - the time available for this call. 0 for infinite.
      Returns:
      computed result
      Throws:
      IOException
    • rpcCall

      protected abstract V rpcCall(int callTimeout) throws Exception
      Throws:
      Exception