Package com.adobe.acs.commons.throttling
Class ThrottlingState
- java.lang.Object
-
- com.adobe.acs.commons.throttling.ThrottlingState
-
public class ThrottlingState extends Object
-
-
Field Summary
Fields Modifier and Type Field Description protected AtomicIntegercurrentIndexprotected LoadEstimatorloadEstimatorprotected Instant[]timestampsThis array holds the timestamps when requests have reached the system; in case the timestamp has already expired, Instant.EPOCH is stored.
-
Constructor Summary
Constructors Modifier Constructor Description protectedThrottlingState(Clock clock, LoadEstimator le)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ThrottlingDecisionevaluateThrottling()protected intresize(int newSize)resize the queue
-
-
-
Field Detail
-
timestamps
protected Instant[] timestamps
This array holds the timestamps when requests have reached the system; in case the timestamp has already expired, Instant.EPOCH is stored. Access to this array should be guarded by the lock.
-
loadEstimator
protected LoadEstimator loadEstimator
-
currentIndex
protected AtomicInteger currentIndex
-
-
Constructor Detail
-
ThrottlingState
protected ThrottlingState(Clock clock, LoadEstimator le)
-
-
Method Detail
-
evaluateThrottling
protected ThrottlingDecision evaluateThrottling()
- Returns:
-
resize
protected int resize(int newSize)
resize the queue- Parameters:
newSize- new size of queue- Returns:
- the number of free entries in the array
-
-