cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ralph Goers <>
Subject Re: components not as factory or pooled
Date Tue, 22 Nov 2005 04:50:30 GMT

Iacturus wrote:

> As the NonThreadSafeComponent uses some API which cannot be made
> threadsafe, there can only be one method of NonThreadSafeComponent
> executed at one time. I cannot change this API and it really has to be
> used exclusively.
> The behavoir i expected to get, is that
> 1) there is a single instance of NonThreadSafeComponent  which may be
> looked up and be used by thread1
> 2) all other threads looking up this component will have to wait while
> the thread1 executes some logic
> 3) after the thread1 releases the instance of NonThreadSafeComponent it
> will be available to the next thread
> (Part 2) should be done by the ServiceManager)
> Thanks, Robert


It doesn't work that way.  The ServiceManager either a) returns a 
singleton if the object is marked ThreadSafe or b) a pooled instance of 
the object if it is not ThreadSafe. In b) if the pool isn't large enough 
then a new object is created and then destroyed when it is released.

Neither of these is what you are asking for.  You need to create a 
ThreadSafe component and then synchronize the non-threadsafe API call.


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

View raw message