- java.lang.Object
-
- jdk.management.resource.SimpleMeter
-
- jdk.management.resource.NotifyingMeter
-
- All Implemented Interfaces:
ResourceMeter
,ResourceRequest
- Direct Known Subclasses:
BoundedMeter
,ThrottledMeter
@Deprecated(since="10", forRemoval=true) public class NotifyingMeter extends SimpleMeter
Deprecated, for removal: This API element is subject to removal in a future version.Resource Management is deprecated for removal with no replacement.A NotifyingMeter provides an approver callback for changes and allocates from an optional parent. The granularity applies only to the approval callback, the amount requested or freed is the same as the amount requested. The granularity may be set at any time. Approval callbacks occur upon crossing the granularity threshold for either allocations or releases. The callback can return the amount requested or zero to indicate the request is denied. Most applications are not resilient to changes to the size of I/O operations or availability of resources.- Since:
- 8u40
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
NotifyingMeter(ResourceType type, ResourceRequest parent, ResourceApprover approver)
Deprecated, for removal: This API element is subject to removal in a future version.Constructor for subclasses.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static NotifyingMeter
create(ResourceType type, ResourceApprover approver)
Deprecated, for removal: This API element is subject to removal in a future version.Returns a new NotifyingMeter with the type and approver.static NotifyingMeter
create(ResourceType type, ResourceRequest parent, ResourceApprover approver)
Deprecated, for removal: This API element is subject to removal in a future version.Returns a new NotifyingMeter with the type, approver and parent approver.ResourceApprover
getApprover()
Deprecated, for removal: This API element is subject to removal in a future version.Return the ResourceApprover.long
getGranularity()
Deprecated, for removal: This API element is subject to removal in a future version.Returns the granularity.long
setGranularity(long granularity)
Deprecated, for removal: This API element is subject to removal in a future version.Sets the granularity.protected long
validate(long previous, long amount, ResourceId id)
Deprecated, for removal: This API element is subject to removal in a future version.Returns the amount validated by the approver.-
Methods declared in class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods declared in interface jdk.management.resource.ResourceMeter
getAllocated, getType, getValue
-
-
-
-
Constructor Detail
-
NotifyingMeter
protected NotifyingMeter(ResourceType type, ResourceRequest parent, ResourceApprover approver)
Deprecated, for removal: This API element is subject to removal in a future version.Constructor for subclasses. The granularity is initialized to 1.- Parameters:
type
- the ResourceTypeparent
- a ResourceRequest to request from; may benull
approver
- the ResourceApprover to be notified; may benull
-
-
Method Detail
-
create
public static NotifyingMeter create(ResourceType type, ResourceApprover approver)
Deprecated, for removal: This API element is subject to removal in a future version.Returns a new NotifyingMeter with the type and approver. The granularity is initialized to 1.- Parameters:
type
- the ResourceTypeapprover
- the ResourceApprover to be notified; may benull
- Returns:
- a new NotifyingMeter with the type and notify
-
create
public static NotifyingMeter create(ResourceType type, ResourceRequest parent, ResourceApprover approver)
Deprecated, for removal: This API element is subject to removal in a future version.Returns a new NotifyingMeter with the type, approver and parent approver. The granularity is initialized to 1.- Parameters:
type
- the ResourceTypeapprover
- the ResourceApprover to notify; may benull
parent
- a ResourceRequest to request from; may benull
- Returns:
- a new NotifyingMeter with the type, notify, and parent approver
-
validate
protected long validate(long previous, long amount, ResourceId id)
Deprecated, for removal: This API element is subject to removal in a future version.Returns the amount validated by the approver. TheResourceApprover.request
must return only the amount requested, zero, or throw aResourceRequestDeniedException
. If the amount returned is any other value, it is ignored and the requested amount is returned.- Overrides:
validate
in classSimpleMeter
- Parameters:
previous
- the previous meter valueamount
- the amount to validate; if zero nothing is doneid
- the ResourceId for the resource instance; may benull
- Returns:
- the value validated zero, positive or negative
-
getGranularity
public final long getGranularity()
Deprecated, for removal: This API element is subject to removal in a future version.Returns the granularity.- Returns:
- the granularity
-
setGranularity
public final long setGranularity(long granularity)
Deprecated, for removal: This API element is subject to removal in a future version.Sets the granularity.- Parameters:
granularity
- Sets the granularity; the granularity must be greater than zero- Returns:
- the previous granularity value
- Throws:
IllegalArgumentException
- if the granularity is less than or equal to zero
-
getApprover
public final ResourceApprover getApprover()
Deprecated, for removal: This API element is subject to removal in a future version.Return the ResourceApprover.- Returns:
- the approver
-
-