@Override
public boolean shouldRetry(Exception e, int retries) throws Exception {
//see (1) and (2) in the javadoc of this method.
final RetryPolicy p;
if (e instanceof RemoteException) {
final RemoteException re = (RemoteException)e;
RetryPolicy found = null;
for(Class<? extends Exception> reToRetry : remoteExceptionsToRetry) {
if (reToRetry.getName().equals(re.getClassName())) {
found = multipleLinearRandomRetry;
break;
}
}
p = found != null? found: RetryPolicies.TRY_ONCE_THEN_FAIL;