avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Courcoux <pe...@courcoux.biz>
Subject Re: Re: Merlin Pooled components
Date Wed, 07 Jan 2004 21:54:58 GMT
Hi Alex,

That looks interesting. I think I can get away with a commons pool
implementation but your code does give me a useful template. Many
thanks.

Peter 

On Wed, 2004-01-07 at 20:16, Alex Karasulu wrote:
> Peter,
> 
> I did just the same here:
> 
> http://cvs.apache.org/repos/asf/incubator/directory/ldap/trunk/eve/frontend/buffer/
> 
> This is a buffer pooler for expensive direct buffers.  Take a 
> look at both the api and the impl projects.
> 
> Alex
> 
> > 
> > From: Stephen McConnell <mcconnell@apache.org>
> > Date: 2004/01/07 Wed PM 12:36:36 EST
> > To: Avalon Developers List <dev@avalon.apache.org>
> > Subject: Re: Merlin Pooled components
> > 
> > Peter Courcoux wrote:
> > > Hi all,
> > > 
> > > I have a requirement for pooling components and am using a version of
> > > merlin which is a couple of months old. I seem to recall that the pooled
> > > lifestyle handling was switched off. Is this still the case and if so,
> > > is there a recommended pattern for providing pooled components?
> > 
> > Correct.
> > 
> > Based on discussion on this subject over the last six months - my 
> > conclusion is that the related semantics area for all intensive purposes 
> > a rather gray area.  This is primarily related to strong relationship 
> > between pool and the components it manages (in particular things like 
> > recycling strategies), and subtle relationships between a component that 
> > is using a pooled component and the pool itself.
> > 
> > My recommendation concerning pooled components is:
> > 
> >     1. declare a factory service with formal instance acquisition
> >        and release methods .. e.g.
> > 
> >          public interface WidgetPool
> >          {
> >              Widget aquireWidget();
> >              void releaseWidget( Widget widget );
> >          }
> > 
> >     2. implement a component the exposes the pooled interface as a
> >        service using whatever pool technology you like (excalibur,
> >        commons pool, etc.)
> > 
> >         /**
> >          * @avalon.service type="WidgetPool"
> >          */
> >          public class DefaultWidgetPool implements WidgetPool
> >          {
> >              ...
> >          }
> > 
> >     3. for consumer components, declare a dependency on the pool
> >        directly
> > 
> >         /**
> >          * @avalon.dependency key="pool" type="WidgetPool"
> >          */
> >          public void service( ServiceManager manager )
> >            throws ServiceException
> >          {
> >               m_pool = (WidgetPool) manager.lookup( "pool" );
> >          }
> > 
> > Using this approach you component implementation is crystal clear about 
> > the assumptions concerning the WidgetPool and your implementation can be 
> > much more strict about acquisition and release policies.
> > 
> > Hope that helps.
> > 
> > Cheers, Stephen.
> > 
> > 
> > > 
> > > I will be grateful for any thoughts.
> > > 
> > > Many thanks.
> > > 
> > > Peter
> > 
> > 
> > -- 
> > |------------------------------------------------|
> > | Magic by Merlin                                |
> > | Production by Avalon                           |
> > |                                                |
> > | http://avalon.apache.org/merlin                |
> > | http://dpml.net/                               |
> > |------------------------------------------------|
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
> > For additional commands, e-mail: dev-help@avalon.apache.org
> > 
> > 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
> For additional commands, e-mail: dev-help@avalon.apache.org
-- 
Peter Courcoux <peter@courcoux.biz>

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


Mime
View raw message