cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ralph Goers <Ralph.Go...@dslextreme.com>
Subject Re: components not as factory or pooled
Date Fri, 18 Nov 2005 16:17:00 GMT
Iacturus wrote:

>> That's the mechanism currently used to flag whether a component is to 
>> be treated as a singleton.  Why wouldn't it be possible?
>
>
> The problem is, that i need to have exclusive access on object 
> (component) level.
> Using the Threadsafe interface will cause the need of java 
> synchronization:

>
> synchronized (myComponent) {
>     myComponent.doSomething1();
>     myComponent.doSomething2();
> }
>
> This is in any case a bottleneck, but i intended to delegate this to 
> the component manager.
> My component is not thread safe and it is not possible to make it 
> thread safe.
>
> Thx, Robert
>
Robert,

You have me totally confused.  Singletons, by their nature, must be 
thread safe as there is only one instance of the object acting on behalf 
of everyone.  So if you want a singleton then you have to synchronize if 
necessary.  The alternative is to create multiple objects to handle each 
request.

I don't see how delegating the non-thread-safe activity to a component 
manager solves the problem.

Ralph


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message