public static class ResourceLimits.Concurrent extends java.lang.Object implements ResourceLimits.Limit
| Constructor and Description |
|---|
Concurrent(long limit) |
| Modifier and Type | Method and Description |
|---|---|
void |
allocate(long amount)
Allocates an amount independent of permits available from this limit.
|
long |
limit() |
ResourceLimits.Outcome |
release(long amount) |
long |
remaining() |
boolean |
tryAllocate(long amount)
Attempts to allocate an amount of permits from this limit.
|
long |
using() |
public long limit()
limit in interface ResourceLimits.LimitResourceLimits.Limit - the capacitypublic long remaining()
remaining in interface ResourceLimits.Limitpublic long using()
using in interface ResourceLimits.Limitpublic boolean tryAllocate(long amount)
ResourceLimits.LimitResourceLimits.Limit.release(long).tryAllocate in interface ResourceLimits.Limittrue if the allocation was successful, false otherwisepublic void allocate(long amount)
ResourceLimits.LimitResourceLimits.Limit.release(long).allocate in interface ResourceLimits.Limitpublic ResourceLimits.Outcome release(long amount)
release in interface ResourceLimits.Limitamount - return the amount of permits back to this limitABOVE_LIMIT if there aren't enough permits available even after the release, or
BELOW_LIMIT if there are enough permits available after the releaese.Copyright © 2009-2022 The Apache Software Foundation