cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ralph Goers <Ralph.Go...@digitalinsight.com>
Subject RE: thread safety of cocoon
Date Tue, 02 Sep 2003 06:40:27 GMT
If I have a generator that is defined as ThreadSafe and it is configured
twice in the generator section of the sitemap, will two instances be created
or one?

Thanks,
Ralph

> -----Original Message-----
> From: Upayavira [mailto:uv@upaya.co.uk]
> Sent: Monday, September 01, 2003 7:28 AM
> To: users@cocoon.apache.org
> Subject: Re: thread safety of cocoon
> 
> 
> Jorg Heymans wrote:
> 
> >When you say a new component then you mean new class right?
> >I don't want the class it to be accessed by more than 1 
> thread at the same
> >time, are you saying this is the default behaviour?
> >
> If you extend org.apache.cocoon.transformation.Transformer (etc), you 
> are creating an Avalon component. How that component is 
> handled depends 
> upon the interfaces that it implements. As Konstantin 
> mentioned, there's 
> Poolable and ThreadSafe. If you do not implement any of these, a new 
> component will be created for each request. If you implement 
> ThreadSafe, 
> your component will be reused.
> 
> So, by default, a component will not be shared between more 
> than one thread.
> 
> Regards, Upayavira
> 
> >
> >Tnx
> >Jorg
> >
> >-----Original Message-----
> >From: Upayavira [mailto:uv@upaya.co.uk] 
> >Sent: Montag, 1. September 2003 15:43
> >To: users@cocoon.apache.org
> >Subject: Re: thread safety of cocoon
> >
> >Jorg Heymans wrote:
> >
> >  
> >
> >>Say i write my own transformer (or serializer, or generator doesn't
> >>    
> >>
> >matter),
> >  
> >
> >>is it true then that a new instance of my custom class is 
> created each time
> >>it is executed in a pipeline? (uncached)
> >>
> >>My code relies on a few instance variables (simple ones 
> like Logger but
> >>    
> >>
> >also
> >  
> >
> >>more crucial ones like StringBuffers for SAX parsing ), 
> I'ld really hate to
> >>find out now that instance variables aren't thread safe in cocoon. 
> >>
> >>
> >>    
> >>
> >AFAIU, you need to make your component implement ThreadSafe 
> for it to be 
> >shared across threads. The default is that a new component 
> is created 
> >for each invocation.
> >
> >Regards, Upayavira
> >
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> >For additional commands, e-mail: users-help@cocoon.apache.org
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> >For additional commands, e-mail: users-help@cocoon.apache.org
> >
> >
> >  
> >
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 

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


Mime
View raw message