Quotapublic class Quota extends Object This class represents a set of quotas for a given quota root.
Each quota root has a set of resources, represented by the
Quota.Resource class. Each resource has a name
(for example, "STORAGE"), a current usage, and a usage limit.
See RFC 2087. |
Fields Summary |
---|
public String | quotaRootThe name of the quota root. | public Resource[] | resourcesThe set of resources associated with this quota root. |
Constructors Summary |
---|
public Quota(String quotaRoot)Create a Quota object for the named quotaroot with no associated
resources.
this.quotaRoot = quotaRoot;
|
Methods Summary |
---|
public void | setResourceLimit(java.lang.String name, long limit)Set a resource limit for this quota root.
if (resources == null) {
resources = new Quota.Resource[1];
resources[0] = new Quota.Resource(name, 0, limit);
return;
}
for (int i = 0; i < resources.length; i++) {
if (resources[i].name.equalsIgnoreCase(name)) {
resources[i].limit = limit;
return;
}
}
Quota.Resource[] ra = new Quota.Resource[resources.length + 1];
System.arraycopy(resources, 0, ra, 0, resources.length);
ra[ra.length - 1] = new Quota.Resource(name, 0, limit);
resources = ra;
|
|