-
- All Known Implementing Classes:
BoundedMeter
,NotifyingMeter
,SimpleMeter
,ThrottledMeter
@Deprecated(since="10", forRemoval=true) public interface ResourceRequest
Deprecated, for removal: This API element is subject to removal in a future version.Resource Management is deprecated for removal with no replacement.A ResourceRequest is an interface to allocate or release resources.- Since:
- 8u40
- See Also:
ResourceMeter
,ResourceContext
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description long
request(long amount, ResourceId id)
Deprecated, for removal: This API element is subject to removal in a future version.Request or releaseamount
units of the resource.
-
-
-
Method Detail
-
request
long request(long amount, ResourceId id)
Deprecated, for removal: This API element is subject to removal in a future version.Request or releaseamount
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.
- Parameters:
amount
- the number of resource units to request (amount > 0
) or release (amount < 0
).id
- the ResourceId for the resource instance- Returns:
- the number of resource units allocated or released
- Throws:
IllegalStateException
- if the ResourceRequest is not in a valid stateResourceRequestDeniedException
- if the request should be denied
-
-