public class ResourceSemaphore extends Semaphore
Semaphore with a limit for a resource.
After close(), the resource becomes unavailable, i.e. any acquire will not succeed.| 限定符和类型 | 类和说明 |
|---|---|
static class |
ResourceSemaphore.Group
Track a group of resources with a list of
ResourceSemaphores. |
| 构造器和说明 |
|---|
ResourceSemaphore(int limit) |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
close()
Close the resource.
|
boolean |
isClosed() |
void |
release() |
void |
release(int permits) |
String |
toString() |
int |
used() |
acquire, acquire, acquireUninterruptibly, acquireUninterruptibly, availablePermits, drainPermits, getQueuedThreads, getQueueLength, hasQueuedThreads, isFair, reducePermits, tryAcquire, tryAcquire, tryAcquire, tryAcquireCopyright © 2017–2023 The Apache Software Foundation. All rights reserved.