Purpose: To maintain concurrency for a paticular task. It is a wrappers of a semaphore that allows recursive waits by a single thread.
Responsibilities:
Purpose: To maintain concurrency for a particular task. It is a wrappers of a semaphore that allows recursive waits by a single thread.
Responsibilities:
Under the covers, this object uses a set of named counting semaphores. A calling thread asks for permission by giving a name to {@link #getPermit(String)}; if no more permits are available on the named semaphore, this manager will throw a runtime exception. In effect, it will abort a thread unless that thread is permitted to continue. Because this manager maintains a dynamic set of named counting semaphores, you can have groups of threads that are allowed to operate independently of other groups of threads (i.e. each group of threads can use their own named semaphore).
Each counting semaphore will be given a default number of total permits. You can set a custom number of permits per counting semaphore by passing in a set of names with their associated number-of-permits-allowed to the constructor.
@author John Mazzitelli
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|