public void add(ExceptionClassification classification) { retry = mergeRetry(retry, classification.isRetry()); hostStatus = natural().max(hostStatus, classification.getHostStatus()); }
public void add(ExceptionClassification classification) { retry = mergeRetry(retry, classification.isRetry()); hostStatus = natural().max(hostStatus, classification.getHostStatus()); }
public ExceptionClassification classifyException(Throwable throwable, boolean idempotent) { if (throwable instanceof ConnectionFailedException) { return new ExceptionClassification(Optional.of(TRUE), DOWN); } if (idempotent && throwable instanceof RequestTimeoutException) { // We don't know if the server is overloaded, or if this specific // request just takes to long, so just mark the server as normal. return new ExceptionClassification(Optional.of(TRUE), NORMAL); } if (throwable instanceof MessageTooLargeException) { return new ExceptionClassification(Optional.of(FALSE), NORMAL); } // interrupted exceptions are always an immediate failure if (throwable instanceof InterruptedException || throwable instanceof InterruptedIOException) { return new ExceptionClassification(Optional.of(FALSE), NORMAL); } // allow classifier to return a hard result ExceptionClassification result = exceptionClassifier.classifyException(unwrapUserException(throwable)); if (result.isRetry().isPresent()) { return result; } if (idempotent && throwable instanceof TTransportException) { // We don't know if there is a problem with this server or if this // is a general network error, so just mark the server as normal. return new ExceptionClassification(Optional.of(TRUE), NORMAL); } return result; }
public ExceptionClassification classifyException(Throwable throwable, boolean idempotent) { if (throwable instanceof ConnectionFailedException) { return new ExceptionClassification(Optional.of(TRUE), DOWN); } if (idempotent && throwable instanceof RequestTimeoutException) { // We don't know if the server is overloaded, or if this specific // request just takes to long, so just mark the server as normal. return new ExceptionClassification(Optional.of(TRUE), NORMAL); } if (throwable instanceof MessageTooLargeException) { return new ExceptionClassification(Optional.of(FALSE), NORMAL); } // interrupted exceptions are always an immediate failure if (throwable instanceof InterruptedException || throwable instanceof InterruptedIOException) { return new ExceptionClassification(Optional.of(FALSE), NORMAL); } // allow classifier to return a hard result ExceptionClassification result = exceptionClassifier.classifyException(unwrapUserException(throwable)); if (result.isRetry().isPresent()) { return result; } if (idempotent && throwable instanceof TTransportException) { // We don't know if there is a problem with this server or if this // is a general network error, so just mark the server as normal. return new ExceptionClassification(Optional.of(TRUE), NORMAL); } return result; }
if (!exceptionClassification.isRetry().orElse(FALSE)) {
if (!exceptionClassification.isRetry().orElse(FALSE)) {