Details
-
New Feature
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
Description
TimedSemaphore is a specialized Semaphore implementation that also has a timing component: In a configurable time period a given number of permits is available. Threads call the semaphore's acquire() method to request a permit. When no more permits are available acquire() blocks the calling thread. At the end of the time period the permits are restored, and all blocking threads are waked up.
The main use case for this class is to provide a convenient means for controlling the load produced by a process. When used correctly, TimedSemaphore ensures that only a given number of steps (e.g. database queries, file operations, or computations) are performed in a specific time period. This may be useful for many applications.
More information including a usage example can be found in the Javadocs of the class. Comments or suggestions for improvements are appreciated.
Attachments
Attachments
Issue Links
- is depended upon by
-
LANG-529 Add a concurrent package
- Closed