avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Donald <pe...@realityforge.org>
Subject Re: Discontinuity between createThreadPool and SoftResourcePool
Date Wed, 11 Dec 2002 22:50:42 GMT
Works for me. Want to send a diff and/or add it into bugzilla.

On Mon, 9 Dec 2002 21:24, Noel J. Bergman wrote:
> Peter,
>
> Actually, I've contributed before by proxy.  And I did mention this some
> months ago, but be that as it may, here is the problem:
>
> org.apache.avalon.cornerstone.blocks.threads.DefaultThreadManager.configure
>T hreadPool:
>
> final DefaultThreadPool threadPool = new DefaultThreadPool(name,
> maxThreads, threadContext);
>
> --------
>
> org.apache.avalon.excalibur.thread.impl.DefaultThreadPool.DefaultThreadPool
>( String name, int capacity, ThreadContext context)
>
>         m_underlyingPool = new SoftResourceLimitingPool( this, capacity );
>
> --------
>
> excalibur.pool.SoftResourceLimitingPool.SoftResourceLimitingPool(ObjectFact
>o ry factory, int min)
>
>         this( factory, null, min, min * 2 );
>
> --------
>
> Note how maxThreads passed by configureThreadPool into DefaultThreadPool as
> the capacity became the min passed to SoftResourceLimitingPool.
>
> One problem is that DefaultThreadPool doesn't have a semantic for min.  The
> int value "capacity" could be interpreted as either a min capacity or a
> max, and obviously there was a disconnect at some point.  My own preference
> is that if you are going to discard something, discard my min, not my max.
>
> As for how you want to fix it, that's up to you.  One way:
>
>     public DefaultThreadPool( final String name,
>                               final int min, final int max,
>                               final ThreadContext context )
>         throws Exception
>     {
>         super( name );
>         m_underlyingPool = new SoftResourceLimitingPool( this, min, max );
>         m_pool = new BasicThreadPool( this, name, m_underlyingPool,
> context );
>     }
>
>     threadPool = new DefaultThreadPool(name, minThreads, maxThreads,
> threadContext);
>
> That's two quick changes.
>
> 	--- Noel
>
> -----Original Message-----
> From: Peter Donald [mailto:peter@realityforge.org]
> Sent: Monday, December 09, 2002 3:09
> To: Avalon Developers List
> Subject: Re: DO NOT REPLY [Bug 15060] - deadlock in ResourceLimitingPool
>
> On Mon, 9 Dec 2002 12:46, Noel J. Bergman wrote:
> > Peter,
> >
> > While you're working in the pooling code, do you think that you could fix
> > the pooling bug that causes the max to become the min, and the real max
> > to be twice the original?
> >
> > Trace the constructor calls.
>
> If you know what the problem is and where the problem is then it is a
> perfect
> opportunity for you to make your first contribution. Otherwise bugzilla it
> so
> it doesn't fall through the cracks.

-- 
Cheers,

Peter Donald
--------------------------------------------
 Beer is proof that God loves us and wants 
 us to be happy. -- Benjamin Franklin
-------------------------------------------- 


--
To unsubscribe, e-mail:   <mailto:avalon-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-dev-help@jakarta.apache.org>


Mime
View raw message