@InterfaceAudience.Private @InterfaceStability.Evolving public class DefaultOperationQuota extends Object implements OperationQuota
OperationQuota.OperationType| Modifier and Type | Field and Description |
|---|---|
private List<QuotaLimiter> |
limiters |
private static org.apache.commons.logging.Log |
LOG |
private long[] |
operationSize |
private long |
readAvailable |
private long |
readConsumed |
private long |
writeAvailable |
private long |
writeConsumed |
| Constructor and Description |
|---|
DefaultOperationQuota(List<QuotaLimiter> limiters)
NOTE: The order matters.
|
DefaultOperationQuota(QuotaLimiter... limiters) |
| Modifier and Type | Method and Description |
|---|---|
void |
addGetResult(Result result)
Add a get result.
|
void |
addMutation(Mutation mutation)
Add a mutation result.
|
void |
addScanResult(List<Result> results)
Add a scan result.
|
void |
checkQuota(int numWrites,
int numReads,
int numScans)
Checks if it is possible to execute the specified operation.
|
void |
close()
Cleanup method on operation completion
|
private long |
estimateConsume(OperationQuota.OperationType type,
int numReqs,
long avgSize) |
long |
getReadAvailable() |
long |
getWriteAvailable() |
private static final org.apache.commons.logging.Log LOG
private final List<QuotaLimiter> limiters
private long writeAvailable
private long readAvailable
private long writeConsumed
private long readConsumed
private final long[] operationSize
public DefaultOperationQuota(QuotaLimiter... limiters)
public DefaultOperationQuota(List<QuotaLimiter> limiters)
public void checkQuota(int numWrites,
int numReads,
int numScans)
throws ThrottlingException
OperationQuotacheckQuota in interface OperationQuotanumWrites - number of write operation that will be performednumReads - number of small-read operation that will be performednumScans - number of long-read operation that will be performedThrottlingException - if the operation cannot be performedpublic void close()
OperationQuotaclose in interface OperationQuotapublic long getReadAvailable()
getReadAvailable in interface OperationQuotapublic long getWriteAvailable()
getWriteAvailable in interface OperationQuotapublic void addGetResult(Result result)
OperationQuotaaddGetResult in interface OperationQuotapublic void addScanResult(List<Result> results)
OperationQuotaaddScanResult in interface OperationQuotapublic void addMutation(Mutation mutation)
OperationQuotaaddMutation in interface OperationQuotaprivate long estimateConsume(OperationQuota.OperationType type, int numReqs, long avgSize)
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.