Interface RequestThrottler
-
- All Superinterfaces:
AutoCloseable,Closeable
public interface RequestThrottler extends Closeable
Limits the number of concurrent requests executed by the driver.Usage in non-blocking applications: beware that some implementations of this interface use locks for internal coordination, and do not qualify as lock-free. If your application enforces strict lock-freedom, then you should use the
PassThroughRequestThrottleror theConcurrencyLimitingRequestThrottler.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voidregister(Throttled request)Registers a new request to be throttled.default voidsignalCancel(Throttled request)Signals that a request has been cancelled.voidsignalError(Throttled request, Throwable error)Signals that a request has failed.voidsignalSuccess(Throttled request)Signals that a request has succeeded.voidsignalTimeout(Throttled request)Signals that a request has timed out.
-
-
-
Method Detail
-
register
void register(@NonNull Throttled request)Registers a new request to be throttled. The throttler will invokeThrottled.onThrottleReady(boolean)when the request is allowed to proceed.
-
signalSuccess
void signalSuccess(@NonNull Throttled request)Signals that a request has succeeded. This indicates to the throttler that another request might be started.
-
signalError
void signalError(@NonNull Throttled request, @NonNull Throwable error)Signals that a request has failed. This indicates to the throttler that another request might be started.
-
signalTimeout
void signalTimeout(@NonNull Throttled request)Signals that a request has timed out. This indicates to the throttler that this request has stopped (if it was running already), or that it doesn't need to be started in the future.Note: requests are responsible for handling their own timeout. The throttler does not perform time-based eviction on pending requests.
-
signalCancel
default void signalCancel(@NonNull Throttled request)Signals that a request has been cancelled. This indicates to the throttler that another request might be started.
-
-