public interface ResourceRequest
ResourceMeter
,
ResourceContext
Modifier and Type | Method and Description |
---|---|
long |
request(long amount,
ResourceId id)
Request or release
amount units of the resource. |
long request(long amount, ResourceId id)
amount
units of the resource. The absolute
value of the argument is the number of resource units. It is positive to
request resources or negative to release them. Zero is a no-op.
The return value is the number of units allocated or released.
If 0, no resources were allocated at the current time.
If the amount is positive and the return value is less than the amount
requested, only that amount was available or allocated.
If the return value is greater than the amount requested,
that amount is allocated and the caller should not request more until
the amount is exhausted or the excess is released.
If the entire amount allocated is not used any remainder should be
released using request( - (amount_to_free) )
.
If the amount is negative, the resource is being released.
amount
- the number of resource units to request (amount > 0
)
or release (amount < 0
).id
- the ResourceId for the resource instanceIllegalStateException
- if the ResourceRequest is not in a valid stateResourceRequestDeniedException
- if the request should be denied
Copyright © 2014, 2016, Oracle and/or its affiliates. All rights reserved.