public interface OccupySupport
| Modifier and Type | Method and Description |
|---|---|
void |
addOccupiedPass(int acquireCount)
Add occupied pass request, which represents pass requests that borrow the latter windows' token.
|
void |
addWaitingRequest(long futureTime,
int acquireCount)
Add request that occupied.
|
double |
occupiedPassQps()
Get current occupied pass QPS.
|
long |
tryOccupyNext(long currentTime,
int acquireCount,
double threshold)
Try to occupy latter time windows' tokens.
|
long |
waiting()
Get current waiting amount.
|
long tryOccupyNext(long currentTime,
int acquireCount,
double threshold)
occupyTimeout in OccupyTimeoutProperty will be return.
Each time we occupy tokens of the future window, current thread should sleep for the
corresponding time for smoothing QPS. We can't occupy tokens of the future with unlimited,
the sleep time limit is occupyTimeout in OccupyTimeoutProperty.
currentTime - current time millis.acquireCount - tokens count to acquire.threshold - qps threshold.occupyTimeout in OccupyTimeoutProperty means
occupy fail, in this case, the request should be rejected immediately.long waiting()
void addWaitingRequest(long futureTime,
int acquireCount)
futureTime - future timestamp that the acquireCount should be added on.acquireCount - tokens count.void addOccupiedPass(int acquireCount)
acquireCount - tokens count.double occupiedPassQps()
Copyright © 2021 Alibaba Group. All rights reserved.