use of com.datastax.oss.driver.api.core.RequestThrottlingException in project zipkin by openzipkin.
the class ResultSetFutureCallTest method isOverCapacity.
// below are load related exceptions which should result in a backoff of storage requests
@Test
public void isOverCapacity() {
assertThat(ResultSetFutureCall.isOverCapacity(new RequestThrottlingException("The session is shutting down"))).isTrue();
assertThat(ResultSetFutureCall.isOverCapacity(new BusyConnectionException(100))).isTrue();
assertThat(ResultSetFutureCall.isOverCapacity(mock(QueryConsistencyException.class))).isTrue();
// not applicable
assertThat(ResultSetFutureCall.isOverCapacity(new IllegalStateException("Rejected execution"))).isFalse();
}
use of com.datastax.oss.driver.api.core.RequestThrottlingException in project java-driver by datastax.
the class GraphRequestHandler method setFinalError.
private void setFinalError(GraphStatement<?> statement, Throwable error, Node node, int execution) {
DriverExecutionProfile executionProfile = Conversions.resolveExecutionProfile(statement, context);
if (error instanceof DriverException) {
((DriverException) error).setExecutionInfo(new DefaultExecutionInfo(statement, node, startedSpeculativeExecutionsCount.get(), execution, errors, null, null, true, session, context, executionProfile));
}
if (result.completeExceptionally(error)) {
cancelScheduledTasks();
if (!(requestTracker instanceof NoopRequestTracker)) {
long latencyNanos = System.nanoTime() - startTimeNanos;
requestTracker.onError(statement, error, latencyNanos, executionProfile, node, logPrefix);
}
if (error instanceof DriverTimeoutException) {
throttler.signalTimeout(this);
sessionMetricUpdater.incrementCounter(DseSessionMetric.GRAPH_CLIENT_TIMEOUTS, executionProfile.getName());
} else if (!(error instanceof RequestThrottlingException)) {
throttler.signalError(this, error);
}
}
}
use of com.datastax.oss.driver.api.core.RequestThrottlingException in project java-driver by datastax.
the class CqlRequestHandler method setFinalError.
private void setFinalError(Statement<?> statement, Throwable error, Node node, int execution) {
DriverExecutionProfile executionProfile = Conversions.resolveExecutionProfile(statement, context);
if (error instanceof DriverException) {
((DriverException) error).setExecutionInfo(new DefaultExecutionInfo(statement, node, startedSpeculativeExecutionsCount.get(), execution, errors, null, null, true, session, context, executionProfile));
}
if (result.completeExceptionally(error)) {
cancelScheduledTasks();
if (!(requestTracker instanceof NoopRequestTracker)) {
long latencyNanos = System.nanoTime() - startTimeNanos;
requestTracker.onError(statement, error, latencyNanos, executionProfile, node, logPrefix);
}
if (error instanceof DriverTimeoutException) {
throttler.signalTimeout(this);
sessionMetricUpdater.incrementCounter(DefaultSessionMetric.CQL_CLIENT_TIMEOUTS, executionProfile.getName());
} else if (!(error instanceof RequestThrottlingException)) {
throttler.signalError(this, error);
}
}
}
Aggregations