Search in sources :

Example 1 with RateLimitingRequestThrottler

use of com.datastax.oss.driver.internal.core.session.throttling.RateLimitingRequestThrottler in project java-driver by datastax.

the class AbstractMetricUpdater method throttlingQueueSize.

protected int throttlingQueueSize() {
    RequestThrottler requestThrottler = context.getRequestThrottler();
    if (requestThrottler instanceof ConcurrencyLimitingRequestThrottler) {
        return ((ConcurrencyLimitingRequestThrottler) requestThrottler).getQueueSize();
    }
    if (requestThrottler instanceof RateLimitingRequestThrottler) {
        return ((RateLimitingRequestThrottler) requestThrottler).getQueueSize();
    }
    LOG.warn("[{}] Metric {} does not support {}, it will always return 0", context.getSessionName(), DefaultSessionMetric.THROTTLING_QUEUE_SIZE.getPath(), requestThrottler.getClass().getName());
    return 0;
}
Also used : RateLimitingRequestThrottler(com.datastax.oss.driver.internal.core.session.throttling.RateLimitingRequestThrottler) ConcurrencyLimitingRequestThrottler(com.datastax.oss.driver.internal.core.session.throttling.ConcurrencyLimitingRequestThrottler) ConcurrencyLimitingRequestThrottler(com.datastax.oss.driver.internal.core.session.throttling.ConcurrencyLimitingRequestThrottler) RequestThrottler(com.datastax.oss.driver.api.core.session.throttling.RequestThrottler) RateLimitingRequestThrottler(com.datastax.oss.driver.internal.core.session.throttling.RateLimitingRequestThrottler)

Aggregations

RequestThrottler (com.datastax.oss.driver.api.core.session.throttling.RequestThrottler)1 ConcurrencyLimitingRequestThrottler (com.datastax.oss.driver.internal.core.session.throttling.ConcurrencyLimitingRequestThrottler)1 RateLimitingRequestThrottler (com.datastax.oss.driver.internal.core.session.throttling.RateLimitingRequestThrottler)1