private static void assertRetriesFailedInformation(Throwable exception, int expectedFailedConnections, int expectedInvocationAttempts, int expectedOverloaded) { RetriesFailedException retriesFailedException = getRetriesFailedException(exception); assertEquals(retriesFailedException.getFailedConnections(), expectedFailedConnections); assertEquals(retriesFailedException.getInvocationAttempts(), expectedInvocationAttempts); assertEquals(retriesFailedException.getOverloadedRejects(), expectedOverloaded); }
private synchronized void fail(String reason) { Throwable cause = lastException; if (cause == null) { // There are no hosts or all hosts are marked down cause = new TTransportException(reason); } RetriesFailedException retriesFailedException = new RetriesFailedException( reason, invocationAttempts, succinctNanos(ticker.read() - startTime), failedConnections, overloadedRejects); // attach message exception to the exception thrown to caller if (cause instanceof DriftApplicationException) { cause.getCause().addSuppressed(retriesFailedException); } else { cause.addSuppressed(retriesFailedException); } setException(cause); }
private synchronized void fail(String reason) { Throwable cause = lastException; if (cause == null) { // There are no hosts or all hosts are marked down cause = new TTransportException(reason); } RetriesFailedException retriesFailedException = new RetriesFailedException( reason, invocationAttempts, succinctNanos(ticker.read() - startTime), failedConnections, overloadedRejects); // attach message exception to the exception thrown to caller if (cause instanceof DriftApplicationException) { cause.getCause().addSuppressed(retriesFailedException); } else { cause.addSuppressed(retriesFailedException); } setException(cause); }