public class NotifyingMeter extends SimpleMeter
| Modifier | Constructor | Description |
|---|---|---|
protected |
NotifyingMeter(ResourceType type,
ResourceRequest parent,
ResourceApprover approver) |
Constructor for subclasses.
|
| Modifier and Type | Method | Description |
|---|---|---|
static NotifyingMeter |
create(ResourceType type,
ResourceApprover approver) |
Returns a new NotifyingMeter with the type and approver.
|
static NotifyingMeter |
create(ResourceType type,
ResourceRequest parent,
ResourceApprover approver) |
Returns a new NotifyingMeter with the type, approver and parent approver.
|
ResourceApprover |
getApprover() |
Return the ResourceApprover.
|
long |
getGranularity() |
Returns the granularity.
|
long |
setGranularity(long granularity) |
Sets the granularity.
|
protected long |
validate(long previous,
long amount,
ResourceId id) |
Returns the amount validated by the approver.
|
protected NotifyingMeter(ResourceType type, ResourceRequest parent, ResourceApprover approver)
type - the ResourceTypeparent - a ResourceRequest to request from; may be nullapprover - the ResourceApprover to be notified; may be nullpublic static NotifyingMeter create(ResourceType type, ResourceApprover approver)
type - the ResourceTypeapprover - the ResourceApprover to be notified; may be nullpublic static NotifyingMeter create(ResourceType type, ResourceRequest parent, ResourceApprover approver)
type - the ResourceTypeapprover - the ResourceApprover to notify; may be nullparent - a ResourceRequest to request from; may be nullprotected long validate(long previous,
long amount,
ResourceId id)
ResourceApprover.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 SimpleMeterprevious - the previous meter valueamount - the amount to validate; if zero nothing is doneid - the ResourceId for the resource instance; may be nullpublic final long getGranularity()
public final long setGranularity(long granularity)
granularity - Sets the granularity;
the granularity must be greater than zeroIllegalArgumentException - if the granularity is less than or equal to zeropublic final ResourceApprover getApprover()
Copyright © 2014, 2025, Oracle and/or its affiliates. All rights reserved.