commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ted Dunning <ted.dunn...@gmail.com>
Subject Re: [lang] New synchronization primitive
Date Sat, 05 Sep 2009 23:31:54 GMT
In particular, why can this not be implemented using the Java 5 primitives?

For instance, a thread could be created that adds tokens at a fixed rate to
a blocking queue up to a small maximum.  Threads wishing to consume the load
bounded resource would request a token before sending a query.  This would
enforce a maximum use rate.

I could imagine a similar use of a semaphore as well.

On Sat, Sep 5, 2009 at 3:03 PM, Mohammad Nour El-Din <
nour.mohammad@gmail.com> wrote:

> Sorry for the question, but why we need a new *concurrent* utils in
> commons-lang while we have  the concurrent package in Java SE 5 ?
>
> On Sat, Sep 5, 2009 at 9:48 PM, Oliver
> Heger<oliver.heger@oliver-heger.de> wrote:
> > 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.
> >
> > Oliver
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> > For additional commands, e-mail: dev-help@commons.apache.org
> >
> >
>
>
>
> --
> Thanks
> - Mohammad Nour
> - LinkedIn: http://www.linkedin.com/in/mnour
> ----
> "Life is like riding a bicycle. To keep your balance you must keep moving"
> - Albert Einstein
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>


-- 
Ted Dunning, CTO
DeepDyve

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message