> -----Original Message-----
> From: peter royal [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, September 08, 2004 4:03 PM
> To: [EMAIL PROTECTED]
> Subject: Re: Sharing cocoon.jar between multiple web aplications
> 
> 
> On Sep 8, 2004, at 9:44 AM, URDINA Michal wrote:
> > I created ear file with about 6 war files. All war files are cocoon 
> > web applications and thus have same WEB-INF/lib 
> directories. The ear 
> > file has apx. 100MB due to duplicity of libraries in 
> WEB-INF/lib's. It 
> > seems reasonable to me to pull up those duplicit libraries at ear 
> > level and share them among web applications.
> >
> > But I'm stuck with the use of static ThreadLocal class 
> fields in some 
> > cocoon classes.
> 
> I do this without any ill effects..
> 
> If the static's weren't ThreadLocals, there would be a problem.. But 
> since they are ThreadLocals, each webapp is still isolated, because 
> you'll only have one thread-per-request at a time.
> -pete
> 

The problem arise only when one web application calls other web application to 
generate its output (via getRequestDispatcher.include() - crosscontext must be 
enabled). Then both webapps use the same static field instance in the same thread. And 
if both are calling method on the same class i.e. Cocoon.process(), then called web 
application can rewrite the value saved by calling web application.

The processing goes like this (all on the same thread):

webapp#1:
        set value
        call webapp#2
webapp#2:
        set value
        doSomething
        get value
        return
webapp#1:
        doSomething
        get value
        return

webapp#1 gets the value saved by webapp#2 and that's not ok:)

Michal

Reply via email to