Leo Sutic wrote:
>
> > -----Original Message-----
> > From: Berin Loritsch [mailto:[EMAIL PROTECTED]
> > Sent: den 2 november 2001 16:50
> > To: Avalon Developers List
> > Subject: Re: Throttling Excalibur
> >
> > My initial attempts to provide a BlockingHardResourceLimitingPool
> > (i.e. one
> > that waits until something is released) resulted in DeadLock in certain
> > circumstances. This is IMO a bad thing--because once you have deadlock,
> > you can't get ANY more connection objects.
>
> Hmmm... It looks like something the DjikstraSemaphore class could be used
> for. Use semaphore.aquire() in get() and semaphore.release() in put(). This,
> of course, means that each thread can only aquire one instance from the
> pool, to prevent deadlock. Is there a way to recognize when a thread has
> taken two items out of the pool and optionally throw an exception in that
> case?
>
> Berin, I'd be quite happy to take a look at whatever code it is you have for
> the blocking pool, along with the test cases (if any).
The last time I tried it, was before our concurrency tools were as robust as
they are now. I committed some changes to conditionally allow blocking
behavior.
There are two options: NonBlocking (fail hard/fast), and Blocking with a
timeout. It is dangerous to allow a system to block without a timeout, or
you will be in deadlock. Therefore if the "timeout" attribute of the
"pool-controller" element is above 0, we will wait that long until we are
woken up by a poolable object being returned.
--
"Those who would trade liberty for
temporary security deserve neither"
- Benjamin Franklin
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>