cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Wallez <>
Subject Re: Is it possible to have poolable actions ?
Date Tue, 10 Feb 2004 17:47:52 GMT
Jorg Heymans wrote:

>> The reason is that Poolable is useful *only* for components that do 
>> have a state that cannot be shared between uses of that components. 
>> Actions have a single act() method and therefore 99% of them are 
>> stateless, and consequently implement ThreadSafe.
> Can i for an action with a ServiceManager instance variable (my class 
> implements serviceable) implement ThreadSafe then instead of Poolable? 
> Is there a possibility of getting in trouble when two threads are 
> simultaneously doing a component lookup on the same servicemanager 
> instance?
> Most of my components have servicemanager as the only instance variable.

The Serviceable interface from which you get the ServiceManager is part 
of the Avalon lifecycle interfaces, which are called when a component 
instance is created. These methods are called once in the lifetime of an 
object, be it ThreadSafe or Poolable.

So data you get in one of the lifecycle interfaces (LogEnabled, 
Contextualizable, Serviceable, Configurable and Initializable) is not 
considered as defining a runtime state.

Therefore, components having only a ServiceManager field can safely be 
made ThreadSafe.


Sylvain Wallez                                  Anyware Technologies 
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }
Orixo, the opensource XML business alliance  -

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message