public static interface ResourceLimits.Limit
ResourceLimits.Concurrent, for shared limits, which is thread-safe;
2. Basic, for limits that are not shared between threads, is not thread-safe.| 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() |
long limit()
ResourceLimits.Limit - the capacitylong remaining()
long using()
boolean tryAllocate(long amount)
release(long).true if the allocation was successful, false otherwisevoid allocate(long amount)
release(long).ResourceLimits.Outcome release(long amount)
amount - 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