You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by Peter Courcoux <pe...@courcoux.biz> on 2004/01/07 18:09:01 UTC

Merlin Pooled components

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?

I will be grateful for any thoughts.

Many thanks.

Peter
-- 
Peter Courcoux <pe...@courcoux.biz>

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


Re: Merlin Pooled components

Posted by Leo Simons <le...@apache.org>.
Stephen McConnell wrote:
> Peter Courcoux wrote:
>> 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.
> 
> Correct.

may I suggest at least some kind of compatibility mode stays available? 
There are tons of components out there which are built for being pooled 
automagically (and clients that assume as much). Shutting this down 
completely means there's a huge range of existing components which won't 
be able to run out of the box inside merlin. I just experienced similar 
issues trying to port an application to type 3 (which cannot support 
this kind of pooling at all), and it was a *major* pain in the ***.

backwards compatibility is a bitch, but still a good idea :D

-- 
cheers,

- Leo Simons

-----------------------------------------------------------------------
Weblog              -- http://leosimons.com/
IoC Component Glue  -- http://jicarilla.org/
Articles & Opinions -- http://lsd.student.utwente.nl/jicarilla/Articles
-----------------------------------------------------------------------
"We started off trying to set up a small anarchist community, but
  people wouldn't obey the rules."
                                                         -- Alan Bennett



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


Re: Merlin Pooled components

Posted by Peter Courcoux <pe...@courcoux.biz>.
Thanks Stephen, 

I've already started implementing something like this using
commons-pool, and your recommendation helps crystallize my thoughts
considerably.

Regards,

Peter

On Wed, 2004-01-07 at 17:36, Stephen McConnell wrote:
> 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
-- 
Peter Courcoux <pe...@courcoux.biz>

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


Re: Merlin Pooled components

Posted by Stephen McConnell <mc...@apache.org>.
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