public class BoundedMeter extends NotifyingMeter implements ResourceMeter, ResourceRequest
| Modifier | Constructor | Description |
|---|---|---|
protected |
BoundedMeter(ResourceType type,
long bound,
ResourceRequest parent,
ResourceApprover approver) |
Constructor of a BoundedMeter.
|
| Modifier and Type | Method | Description |
|---|---|---|
static BoundedMeter |
create(ResourceType type,
long bound) |
Returns a new BoundedMeter with the type and upper bound.
|
static BoundedMeter |
create(ResourceType type,
long bound,
ResourceApprover approver) |
Returns a new BoundedMeter with the type, upper bound, and approver.
|
static BoundedMeter |
create(ResourceType type,
long bound,
ResourceRequest parent) |
Returns a new BoundedMeter with the type, upper bound, and parent.
|
static BoundedMeter |
create(ResourceType type,
long bound,
ResourceRequest parent,
ResourceApprover approver) |
Returns a new BoundedMeter with the type, upper bound, parent, and
approver.
|
long |
getBound() |
Returns the upper bound for the meter.
|
long |
setBound(long bound) |
Sets the bound.
|
String |
toString() |
Returns a string representation of the meter.
|
protected long |
validate(long previous,
long amount,
ResourceId id) |
Returns the amount validated by the approver.
|
create, create, getApprover, getGranularity, setGranularitycreate, create, equals, getAllocated, getParent, getType, getValue, hashCode, requestclone, finalize, getClass, notify, notifyAll, wait, wait, waitgetAllocated, getType, getValuerequestprotected BoundedMeter(ResourceType type, long bound, ResourceRequest parent, ResourceApprover approver)
type - the ResourceType of the meterbound - the initial upper boundparent - a ResourceRequest to request from; may be nullapprover - the ResourceApprover to be notified; may be nullpublic static BoundedMeter create(ResourceType type, long bound)
type - the ResourceTypebound - the upper bound; must be zero or greaterIllegalArgumentException - if the bound is less than zeropublic static BoundedMeter create(ResourceType type, long bound, ResourceRequest parent)
type - the ResourceTypebound - the upper bound; must be zero or greaterparent - a ResourceRequest to request from; may be nullIllegalArgumentException - if the bound is less than zeropublic static BoundedMeter create(ResourceType type, long bound, ResourceRequest parent, ResourceApprover approver)
type - the ResourceTypebound - the upper bound; must be zero or greaterparent - a ResourceRequest to request from; may be nullapprover - the ResourceApprover to be notified; may be nullIllegalArgumentException - if the bound is less than zeropublic static BoundedMeter create(ResourceType type, long bound, ResourceApprover approver)
type - the ResourceTypebound - the upper bound; must be zero or greaterapprover - the ResourceApprover to be notified; may be nullIllegalArgumentException - if the bound is less than zeroprotected long validate(long previous,
long amount,
ResourceId id)
NotifyingMeterResourceApprover.request
must return only the amount requested, zero, or
throw a ResourceRequestDeniedException.
If the amount returned is any other value, it is ignored and the
requested amount is returned.validate in class NotifyingMeterprevious - the previous meter valueamount - the amount to validate; if zero nothing is doneid - the ResourceId for the resource instance; may be nullpublic final long getBound()
public final long setBound(long bound)
bound - the bound; must be zero or greaterIllegalArgumentException - if the bound is less than zeropublic String toString()
SimpleMetertoString in class SimpleMeter
Copyright © 2014, 2025, Oracle and/or its affiliates. All rights reserved.