You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Gerhard Froehlich <g-...@gmx.de> on 2001/07/14 15:34:07 UTC

[C2] ThreadSafe Interface

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!

Cheers
Gerhard




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


Re: AW: [C2] ThreadSafe Interface

Posted by Berin Loritsch <bl...@apache.org>.

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.

Re: AW: [C2] ThreadSafe Interface

Posted by giacomo <gi...@apache.org>.
On Sun, 15 Jul 2001, 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".

There is not pool needed.

> 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.

No, no. All requesting threads get the very same instance.

> 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?

No, you don't. A ThreadSafe component should be code that is
known as "reentrant" code.

Giacomo


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


AW: [C2] ThreadSafe Interface

Posted by Gerhard Froehlich <g-...@gmx.de>.
>> 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?

Cheers
Gerhard


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


Re: [C2] ThreadSafe Interface

Posted by Berin Loritsch <bl...@yahoo.com>.
On Monday, I will have checked in the HTML rendered
whitepaper to Avalon's CVS.  If we have consensus,
on the Avalon list, we will also make the whitepaper
available on the Avalon site.  This will explain alot.

--- giacomo <gi...@apache.org> wrote:
> On Sat, 14 Jul 2001, 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.
> 
> Hope these are few words enought to explain.
> 
> Giacomo
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> cocoon-dev-unsubscribe@xml.apache.org
> For additional commands, email:
> cocoon-dev-help@xml.apache.org
> 


__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/

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


Re: [C2] ThreadSafe Interface

Posted by giacomo <gi...@apache.org>.
On Sat, 14 Jul 2001, 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.

Hope these are few words enought to explain.

Giacomo


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