|
Apache Tomcat 7.0.28 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.tomcat.util.threads.LimitLatch
public class LimitLatch
Shared latch that allows the latch to be acquired a limited number of times after which all subsequent requests to acquire the latch will be placed in a FIFO queue until one of the shares is returned.
Constructor Summary | |
---|---|
LimitLatch(long limit)
Instantiates a LimitLatch object with an initial limit. |
Method Summary | |
---|---|
long |
countDown()
Releases a shared latch, making it available for another thread to use. |
void |
countUpOrAwait()
Acquires a shared latch if one is available or waits for one if no shared latch is current available. |
long |
getCount()
Returns the current count for the latch |
long |
getLimit()
Obtain the current limit. |
Collection<Thread> |
getQueuedThreads()
Provide access to the list of threads waiting to acquire this limited shared latch. |
boolean |
hasQueuedThreads()
Returns true if there is at least one thread waiting to
acquire the shared lock, otherwise returns false . |
boolean |
releaseAll()
Releases all waiting threads and causes the limit to be ignored
until reset() is called. |
void |
reset()
Resets the latch and initializes the shared acquisition counter to zero. |
void |
setLimit(long limit)
Sets a new limit. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public LimitLatch(long limit)
limit
- - maximum number of concurrent acquisitions of this latchMethod Detail |
---|
public long getCount()
public long getLimit()
public void setLimit(long limit)
limit
- The new limitpublic void countUpOrAwait() throws InterruptedException
InterruptedException
public long countDown()
public boolean releaseAll()
limit
to be ignored
until reset()
is called.
public void reset()
releaseAll()
public boolean hasQueuedThreads()
true
if there is at least one thread waiting to
acquire the shared lock, otherwise returns false
.
public Collection<Thread> getQueuedThreads()
|
Apache Tomcat 7.0.28 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |