Module org.elasticsearch.security
Class LogThrottle
java.lang.Object
org.elasticsearch.xpack.security.support.LogThrottle
Limits how often an action (such as emitting a log line) may run. Each instance tracks its own window.
-
Constructor Summary
ConstructorsConstructorDescriptionLogThrottle(ThreadPool threadPool, org.elasticsearch.core.TimeValue period) Constructs a new instance usingThreadPool.relativeTimeInMillis()as the time source andTimeValue.millis()as the period. -
Method Summary
-
Constructor Details
-
LogThrottle
Constructs a new instance usingThreadPool.relativeTimeInMillis()as the time source andTimeValue.millis()as the period.
-
-
Method Details
-
acquire
public boolean acquire()- Returns:
trueif the configured period has elapsed since the lasttruereturn (or if this is the first time the method has been called); updates the internal timestamp when returningtrue.This method is not thread safe; concurrent
acquirecalls may both observe the window as elapsed, or have other races. Use a single-caller pattern or external synchronization if a hard guarantee is required.
-