me.prettyprint.cassandra.service
Class FailoverPolicy<E extends Throwable>

java.lang.Object
  extended by me.prettyprint.cassandra.service.FailoverPolicy<E>

public class FailoverPolicy<E extends Throwable>
extends Object

What should the client do if a call to cassandra node fails and we suspect that the node is down. (e.g. it's a communication error, not an application error). will return the error as is to the user and not try anything smart will try one more random server before returning to the user with an error will try all available servers in the cluster before giving up and returning the communication error to the user.


Field Summary
 Set<Class<E>> dontRetry
          Optional set of classes representing Exceptions/Errors for which retry should not happen.
static FailoverPolicy FAIL_FAST
          On communication failure, just return the error to the client and don't retry
 int numRetries
           
static FailoverPolicy ON_FAIL_TRY_ALL_AVAILABLE
          On communication error try all known servers before giving up
static FailoverPolicy ON_FAIL_TRY_ONE_NEXT_AVAILABLE
          On communication error try one more server before giving up
 int sleepBetweenHostsMilli
           
 
Constructor Summary
FailoverPolicy(int numRetries, int sleepBwHostsMilli)
           
FailoverPolicy(int numRetries, int sleepBwHostsMilli, Class<E> dontRetryForType)
           
FailoverPolicy(int numRetries, int sleepBwHostsMilli, Set<Class<E>> dontRetryForTypes)
           
 
Method Summary
 boolean shouldRetryFor(Class<E> candidate)
          Determines if a given class is an exception or error that this FailoverPolicy supports retry for.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FAIL_FAST

public static FailoverPolicy FAIL_FAST
On communication failure, just return the error to the client and don't retry


ON_FAIL_TRY_ONE_NEXT_AVAILABLE

public static FailoverPolicy ON_FAIL_TRY_ONE_NEXT_AVAILABLE
On communication error try one more server before giving up


ON_FAIL_TRY_ALL_AVAILABLE

public static FailoverPolicy ON_FAIL_TRY_ALL_AVAILABLE
On communication error try all known servers before giving up


numRetries

public final int numRetries

sleepBetweenHostsMilli

public final int sleepBetweenHostsMilli

dontRetry

public final Set<Class<E extends Throwable>> dontRetry
Optional set of classes representing Exceptions/Errors for which retry should not happen.

Constructor Detail

FailoverPolicy

public FailoverPolicy(int numRetries,
                      int sleepBwHostsMilli)

FailoverPolicy

public FailoverPolicy(int numRetries,
                      int sleepBwHostsMilli,
                      Class<E> dontRetryForType)

FailoverPolicy

public FailoverPolicy(int numRetries,
                      int sleepBwHostsMilli,
                      Set<Class<E>> dontRetryForTypes)
Method Detail

shouldRetryFor

public boolean shouldRetryFor(Class<E> candidate)
Determines if a given class is an exception or error that this FailoverPolicy supports retry for. This is a supplement to the explicit behavior defined in HConnectionManager.



Copyright © 2013. All Rights Reserved.