Quotas.Governable, Quotas.SimpleQuotas| 限定符和类型 | 字段和说明 |
|---|---|
protected AtomicInteger |
m_Count
已用配额
|
protected int |
m_Max
最大限额
|
| 构造器和说明 |
|---|
SimpleQuotas() |
SimpleQuotas(int max) |
| 限定符和类型 | 方法和说明 |
|---|---|
protected int |
calcQuota(int quota,
Quotas.Governable resource,
int concurrent) |
int |
getCount()
获取正使用的(总)配额
|
int |
getMax()
获取最大值(总配额)
|
int |
getQuota(Quotas.Governable resource,
int concurrent)
指定资源的当前可用配额
|
int |
refund(Object resource)
归还配额
|
void |
reset()
重置(置零)已用配额,特殊情况下使用
|
void |
setMax(int max) |
String |
toString() |
int |
use(Quotas.Governable resource,
int concurrent)
使用配额
|
protected int m_Max
protected AtomicInteger m_Count
public void setMax(int max)
protected int calcQuota(int quota,
Quotas.Governable resource,
int concurrent)
public int getQuota(Quotas.Governable resource, int concurrent)
Quotaspublic int use(Quotas.Governable resource, int concurrent) throws OverquotaException
Quotasuse 在接口中 Quotasresource - 使用配额的资源项concurrent - 资源的并发数(正在使用数)OverquotaException - 若超过配额抛出异常public void reset()
Copyright © 2021. All rights reserved.