@InterfaceAudience.Private @InterfaceStability.Evolving public class TimeBasedLimiter extends Object implements QuotaLimiter
| 限定符和类型 | 方法和说明 |
|---|---|
void |
checkQuota(long writeReqs,
long estimateWriteSize,
long readReqs,
long estimateReadSize)
Checks if it is possible to execute the specified operation.
|
void |
consumeRead(long size)
Removes or add back some read amount to the quota.
|
void |
consumeWrite(long size)
Removes or add back some write amount to the quota.
|
long |
getReadAvailable() |
long |
getWriteAvailable() |
void |
grabQuota(long writeReqs,
long writeSize,
long readReqs,
long readSize)
Removes the specified write and read amount from the quota.
|
boolean |
isBypass() |
String |
toString() |
void |
update(TimeBasedLimiter other) |
public void update(TimeBasedLimiter other)
public void checkQuota(long writeReqs,
long estimateWriteSize,
long readReqs,
long estimateReadSize)
throws RpcThrottlingException
QuotaLimitercheckQuota 在接口中 QuotaLimiterwriteReqs - the write requests that will be checked against the available quotaestimateWriteSize - the write size that will be checked against the available quotareadReqs - the read requests that will be checked against the available quotaestimateReadSize - the read size that will be checked against the available quotaRpcThrottlingException - thrown if not enough available resources to perform operation.public void grabQuota(long writeReqs,
long writeSize,
long readReqs,
long readSize)
QuotaLimitergrabQuota 在接口中 QuotaLimiterwriteReqs - the write requests that will be removed from the current quotawriteSize - the write size that will be removed from the current quotareadReqs - the read requests that will be removed from the current quotareadSize - the read size that will be removed from the current quotapublic void consumeWrite(long size)
QuotaLimiterconsumeWrite 在接口中 QuotaLimiterpublic void consumeRead(long size)
QuotaLimiterconsumeRead 在接口中 QuotaLimiterpublic boolean isBypass()
isBypass 在接口中 QuotaLimiterpublic long getWriteAvailable()
getWriteAvailable 在接口中 QuotaLimiterpublic long getReadAvailable()
getReadAvailable 在接口中 QuotaLimiterCopyright © 2007–2019 The Apache Software Foundation. All rights reserved.