| Modifier and Type | Class and Description |
|---|---|
| private class |
| Modifier and Type | Field and Description |
|---|---|
| private final AtomicLong | |
| private volatile long | |
| private static final Log | |
| private volatile boolean | |
| private final LimitLatch. |
| Access | Constructor and Description |
|---|---|
| public | LimitLatch(long
- maximum number of concurrent acquisitions of this latch limit)Instantiates a LimitLatch object with an initial limit. |
| Modifier and Type | Method and Description |
|---|---|
| public long | Returns: the previous counter valueReleases a shared latch, making it available for another thread to use. |
| public void | countUpOrAwait()
Acquires a shared latch if one is available or waits for one if no shared latch is current available. |
| public long | |
| public long | |
| public Collection | Returns: a collection of threadsProvide access to the list of threads waiting to acquire this limited shared latch. |
| public boolean | Returns: true if threads are waitingReturns |
| public boolean | Returns: true if release was doneReleases all waiting threads and causes the |
| public void | |
| public void |
| count | back to summary |
|---|---|
| private final AtomicLong count | |
| limit | back to summary |
|---|---|
| private volatile long limit | |
| log | back to summary |
|---|---|
| private static final Log log | |
| released | back to summary |
|---|---|
| private volatile boolean released | |
| sync | back to summary |
|---|---|
| private final LimitLatch. | |
| LimitLatch | back to summary |
|---|---|
| public LimitLatch(long limit) Instantiates a LimitLatch object with an initial limit.
| |
| countDown | back to summary |
|---|---|
| public long countDown() Releases a shared latch, making it available for another thread to use.
| |
| countUpOrAwait | back to summary |
|---|---|
| public void countUpOrAwait() throws InterruptedException Acquires a shared latch if one is available or waits for one if no shared latch is current available.
| |
| getCount | back to summary |
|---|---|
| public long getCount() Returns the current count for the latch
| |
| getLimit | back to summary |
|---|---|
| public long getLimit() Obtain the current limit.
| |
| getQueuedThreads | back to summary |
|---|---|
| public Collection Provide access to the list of threads waiting to acquire this limited shared latch.
| |
| hasQueuedThreads | back to summary |
|---|---|
| public boolean hasQueuedThreads() Returns
| |
| releaseAll | back to summary |
|---|---|
| public boolean releaseAll() Releases all waiting threads and causes the
| |
| reset | back to summary |
|---|---|
| public void reset() Resets the latch and initializes the shared acquisition counter to zero.
| |
| setLimit | back to summary |
|---|---|
| public void setLimit(long limit) Sets a new limit. If the limit is decreased there may be a period where more shares of the latch are acquired than the limit. In this case no more shares of the latch will be issued until sufficient shares have been returned to reduce the number of acquired shares of the latch to below the new limit. If the limit is increased, threads currently in the queue may not be issued one of the newly available shares until the next request is made for a latch.
| |
| Modifier and Type | Field and Description |
|---|---|
| private static final long |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| protected int | tryAcquireShared(int
the acquire argument. This value is always the one
passed to an acquire method, or is the value saved on entry
to a condition wait. The value is otherwise uninterpreted
and can represent anything you like. ignored)Overrides java. Attempts to acquire in shared mode. |
| protected boolean | tryReleaseShared(int
the release argument. This value is always the one
passed to a release method, or the current state value upon
entry to a condition wait. The value is otherwise
uninterpreted and can represent anything you like. arg)Overrides java. Attempts to set the state to reflect a release in shared mode. |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Hides java. | |
| Sync | back to summary |
|---|---|
| pack-priv Sync() | |
| tryAcquireShared | back to summary |
|---|---|
| protected int tryAcquireShared(int ignored) Overrides java. Doc from java. Attempts to acquire in shared mode. This method should query if the state of the object permits it to be acquired in the shared mode, and if so to acquire it. This method is always invoked by the thread performing acquire. If this method reports failure, the acquire method may queue the thread, if it is not already queued, until it is signalled by a release from some other thread. The default implementation throws
| |
| tryReleaseShared | back to summary |
|---|---|
| protected boolean tryReleaseShared(int arg) Overrides java. Doc from java. Attempts to set the state to reflect a release in shared mode. This method is always invoked by the thread performing release. The default implementation throws
| |