commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oliver Heger <>
Subject [lang] New synchronization primitive
Date Sat, 05 Sep 2009 18:48:21 GMT
In my day job I have written a synchronization primitive that may be of 
interest for the proposed concurrent package of the new version of 
commons-lang. I first want to check whether there is interest in this 
stuff, then I can talk to my employer about the code donation (which 
hopefully should not be a problem).

Now to the synchronization primitive: It is a class called "LoadBarrier" 
that is somewhat similar to a semaphor in that it allows a configurable 
number of locks to be hold. But there is also a timing aspect: The limit 
of locks is enforced in a configurable time unit. If a thread requests 
another lock when the maximum number of locks is already reached, it 
gets blocked until the time unit is over. After that all blocked threads 
are freed and can again try to aquire a lock.

The background of this class is that it provides an easy way of 
controlling the load produced by a process or enforcing a threashold. In 
our use case we had a background process running queries on a database 
for statistical evaluations. To ensure that the database load does not 
affect the system a LoadBarrier was used that enforced a limit of 
database queries per second.

WDYT? If there is interest, I am going to address my employer and then 
create a JIRA enhancement ticket.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message