org.apache.hadoop.hbase.client
Class DelegatingRetryingCallable<T,D extends RetryingCallable<T>>

java.lang.Object
  extended by org.apache.hadoop.hbase.client.DelegatingRetryingCallable<T,D>
All Implemented Interfaces:
Callable<T>, RetryingCallable<T>

public class DelegatingRetryingCallable<T,D extends RetryingCallable<T>>
extends Object
implements RetryingCallable<T>


Field Summary
protected  D delegate
           
 
Constructor Summary
DelegatingRetryingCallable(D delegate)
           
 
Method Summary
 T call()
           
 String getExceptionMessageAdditionalDetail()
           
 void prepare(boolean reload)
          Prepare by setting up any connections to servers, etc., ahead of Callable.call() invocation.
 long sleep(long pause, int tries)
           
 void throwable(Throwable t, boolean retrying)
          Called when Callable.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
 

Field Detail

delegate

protected final D extends RetryingCallable<T> delegate
Constructor Detail

DelegatingRetryingCallable

public DelegatingRetryingCallable(D delegate)
Method Detail

call

public T call()
       throws Exception
Specified by:
call in interface Callable<T>
Throws:
Exception

prepare

public void prepare(boolean reload)
             throws IOException
Description copied from interface: RetryingCallable
Prepare by setting up any connections to servers, etc., ahead of Callable.call() invocation.

Specified by:
prepare in interface RetryingCallable<T>
Parameters:
reload - Set this to true if need to requery locations (usually set on second invocation to Callable.call() or whatever
Throws:
IOException - e

throwable

public void throwable(Throwable t,
                      boolean retrying)
Description copied from interface: RetryingCallable
Called when Callable.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<T>
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

public String getExceptionMessageAdditionalDetail()
Specified by:
getExceptionMessageAdditionalDetail in interface RetryingCallable<T>
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

public long sleep(long pause,
                  int tries)
Specified by:
sleep in interface RetryingCallable<T>
Returns:
Suggestion on how much to sleep between retries


Copyright © 2007-2015 The Apache Software Foundation. All Rights Reserved.