Search in sources :

Example 1 with RequestThrottlingException

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();
}
Also used : BusyConnectionException(com.datastax.oss.driver.api.core.connection.BusyConnectionException) QueryConsistencyException(com.datastax.oss.driver.api.core.servererrors.QueryConsistencyException) RequestThrottlingException(com.datastax.oss.driver.api.core.RequestThrottlingException) Test(org.junit.Test)

Example 2 with RequestThrottlingException

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);
        }
    }
}
Also used : DriverExecutionProfile(com.datastax.oss.driver.api.core.config.DriverExecutionProfile) NoopRequestTracker(com.datastax.oss.driver.internal.core.tracker.NoopRequestTracker) DriverTimeoutException(com.datastax.oss.driver.api.core.DriverTimeoutException) DefaultExecutionInfo(com.datastax.oss.driver.internal.core.cql.DefaultExecutionInfo) DriverException(com.datastax.oss.driver.api.core.DriverException) RequestThrottlingException(com.datastax.oss.driver.api.core.RequestThrottlingException)

Example 3 with RequestThrottlingException

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);
        }
    }
}
Also used : DriverExecutionProfile(com.datastax.oss.driver.api.core.config.DriverExecutionProfile) NoopRequestTracker(com.datastax.oss.driver.internal.core.tracker.NoopRequestTracker) DriverTimeoutException(com.datastax.oss.driver.api.core.DriverTimeoutException) DriverException(com.datastax.oss.driver.api.core.DriverException) RequestThrottlingException(com.datastax.oss.driver.api.core.RequestThrottlingException)

Aggregations

RequestThrottlingException (com.datastax.oss.driver.api.core.RequestThrottlingException)3 DriverException (com.datastax.oss.driver.api.core.DriverException)2 DriverTimeoutException (com.datastax.oss.driver.api.core.DriverTimeoutException)2 DriverExecutionProfile (com.datastax.oss.driver.api.core.config.DriverExecutionProfile)2 NoopRequestTracker (com.datastax.oss.driver.internal.core.tracker.NoopRequestTracker)2 BusyConnectionException (com.datastax.oss.driver.api.core.connection.BusyConnectionException)1 QueryConsistencyException (com.datastax.oss.driver.api.core.servererrors.QueryConsistencyException)1 DefaultExecutionInfo (com.datastax.oss.driver.internal.core.cql.DefaultExecutionInfo)1 Test (org.junit.Test)1