public class EnhancedSemaphore
extends java.util.concurrent.Semaphore
| Modifier and Type | Field and Description |
|---|---|
private static long |
serialVersionUID |
| Constructor and Description |
|---|
EnhancedSemaphore(int permits)
Creates a new EnhancedSemaphore, delegating to the Semaphore class constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
withSemaphore(groovy.lang.Closure cl)
Performs the passed-in closure with the Semaphore acquired and releases the Semaphore automatically
after the closure finishes.
|
acquire, acquire, acquireUninterruptibly, acquireUninterruptibly, availablePermits, drainPermits, getQueuedThreads, getQueueLength, hasQueuedThreads, isFair, reducePermits, release, release, toString, tryAcquire, tryAcquire, tryAcquire, tryAcquireprivate static final long serialVersionUID
public EnhancedSemaphore(int permits)
permits - Maximum number of concurrently accepted threads.public void withSemaphore(groovy.lang.Closure cl)
throws java.lang.InterruptedException
cl - The closure to perform with the Semaphore acquiredjava.lang.InterruptedException - If the current thread gets interrupted