static boolean isIndicativeOfCassandraLoad(Throwable ex) { // TODO (jkong): Make NoSuchElementException its own thing - that is NOT necessarily indicative of C* load. return ex != null // pool for this node is fully in use && (ex instanceof NoSuchElementException // Cassandra timeout. Maybe took too long to CAS, or Cassandra is under load. || ex instanceof TimedOutException // remote cassandra node couldn't talk to enough other remote cassandra nodes to answer || ex instanceof UnavailableException // Not enough Cassandra nodes are up. || ex instanceof InsufficientConsistencyException || isIndicativeOfCassandraLoad(ex.getCause())); }
@Override public boolean shouldRetryOnDifferentHost(Exception ex, int maxTriesSameHost, int numberOfAttempts) { return isFastFailoverException(ex) || isIndicativeOfCassandraLoad(ex) || numberOfAttempts >= maxTriesSameHost; } }
@Override public boolean shouldBackoff(Exception ex) { return isConnectionException(ex) || isIndicativeOfCassandraLoad(ex); }
@VisibleForTesting static boolean isRetryable(Exception ex) { return isConnectionException(ex) || isTransientException(ex) || isIndicativeOfCassandraLoad(ex) || isFastFailoverException(ex); }
static boolean isIndicativeOfCassandraLoad(Throwable ex) { // TODO (jkong): Make NoSuchElementException its own thing - that is NOT necessarily indicative of C* load. return ex != null // pool for this node is fully in use && (ex instanceof NoSuchElementException // Cassandra timeout. Maybe took too long to CAS, or Cassandra is under load. || ex instanceof TimedOutException // remote cassandra node couldn't talk to enough other remote cassandra nodes to answer || ex instanceof UnavailableException // Not enough Cassandra nodes are up. || ex instanceof InsufficientConsistencyException || isIndicativeOfCassandraLoad(ex.getCause())); }
@Override public boolean shouldRetryOnDifferentHost(Exception ex, int maxTriesSameHost, int numberOfAttempts) { return isFastFailoverException(ex) || isIndicativeOfCassandraLoad(ex) || numberOfAttempts >= maxTriesSameHost; } }
@Override public boolean shouldBackoff(Exception ex) { return isConnectionException(ex) || isIndicativeOfCassandraLoad(ex); }
@VisibleForTesting static boolean isRetryable(Exception ex) { return isConnectionException(ex) || isTransientException(ex) || isIndicativeOfCassandraLoad(ex) || isFastFailoverException(ex); }