com.netflix.astyanax.retry
Class SleepingRetryPolicy

java.lang.Object
  extended by com.netflix.astyanax.retry.SleepingRetryPolicy
All Implemented Interfaces:
RetryPolicy
Direct Known Subclasses:
ConstantBackoff, ExponentialBackoff

public abstract class SleepingRetryPolicy
extends Object
implements RetryPolicy

Base sleeping retry policy with optional count limit

Author:
elandau

Constructor Summary
SleepingRetryPolicy(int max)
           
 
Method Summary
 boolean allowRetry()
          Ask the policy if a retry is allowed.
 void begin()
          Operation is starting
 void failure(Exception e)
          Operation has failed
 int getAttemptCount()
          Return the number of attempts since begin was called
 int getMax()
           
abstract  long getSleepTimeMs()
           
 void success()
          Operation has completed successfully
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.netflix.astyanax.retry.RetryPolicy
duplicate
 

Constructor Detail

SleepingRetryPolicy

public SleepingRetryPolicy(int max)
Method Detail

allowRetry

public boolean allowRetry()
Description copied from interface: RetryPolicy
Ask the policy if a retry is allowed. This may internally sleep

Specified by:
allowRetry in interface RetryPolicy
Returns:

getSleepTimeMs

public abstract long getSleepTimeMs()

begin

public void begin()
Description copied from interface: RetryPolicy
Operation is starting

Specified by:
begin in interface RetryPolicy

success

public void success()
Description copied from interface: RetryPolicy
Operation has completed successfully

Specified by:
success in interface RetryPolicy

failure

public void failure(Exception e)
Description copied from interface: RetryPolicy
Operation has failed

Specified by:
failure in interface RetryPolicy

getAttemptCount

public int getAttemptCount()
Description copied from interface: RetryPolicy
Return the number of attempts since begin was called

Specified by:
getAttemptCount in interface RetryPolicy
Returns:

getMax

public int getMax()

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2012. All Rights Reserved.