cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Berin Loritsch <blorit...@apache.org>
Subject Re: AW: [C2] ThreadSafe Interface
Date Mon, 16 Jul 2001 04:18:08 GMT


Gerhard Froehlich wrote:
> 
> >> Hi,
> >> some questions to the ThreadSafe interface:
> >>
> >> 1.Could somebody explain in few words what this ThreadSafe
> >> Interface is doing?
> >> Because the avalon api description is not really helpfull!
> 
> >The Avalon ComponentManager will share a single instance of this
> >Component across requestors. It's something like producing a Singleton
> >within the Avalon component managerment system.
> Ok I understand. There is only one instance of the class in a "pool". When
> requesting (thread, something else) for this class, the manager lock this
> instance and only the calling thread can use it. Others have to wait.
> Cool. That means public methods which are accessed by requestors must not be
> synchronized, or?
> But when I start an inner thread, which calls a private method in
> this class, this method should be synchronized if needed. Do I have the
> right
> approach?

Not quite.

For the ThreadSafe Component, there is one component.  All accesses to
the component can happen at the same time.  That means you can have 40
threads simultaneously access the component.  Any synchronization that
is required is up to you to manage.
Mime
View raw message