cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From imran <>
Subject Re: Objects inherited in subrequests
Date Tue, 15 Jul 2008 00:39:07 GMT
Hello all

Grzegorz as u wrote...

Therefore I would like to propose introduction of a new scope called 
"request-inheritable" which
would allow beans (like ObjectModel) to be inherited but by cloning.

can you please elaborate on that ... coz thats where we are stuck ...  
if u have a look at the file

public void forwardTo(String uri, Object bizData,
                          WebContinuation continuation,
                          Redirector redirector)
    throws Exception {
        if (SourceUtil.indexOfSchemeColon(uri) == -1) {
            uri = "cocoon:/" + uri;
            final Map objectModel = 
            FlowHelper.setWebContinuation(objectModel, newObjectModel, 
            FlowHelper.setContextObject(objectModel, newObjectModel, 
            if (redirector.hasRedirected()) {
                throw new IllegalStateException("Pipeline has already 
been processed for this request");
            // this is a hint for the redirector
            objectModel.put("cocoon:forward", "true");
            redirector.redirect(false, uri);
        } else {
            throw new Exception("uri is not allowed to contain a scheme 
(cocoon:/ is always automatically used)");

so the instance of newObjectModel is the one from the bean factory ... 
and if u have multithreading then all the threads change that 
objectmodel simultaneously and then finally the objectmodel coming to 
the JXTemplategenerator(Injected by spring) is not thread specific ... 

in the setup method of the generator class we replace the objectmodel 
injected by spring with the one passed with that method ... after doing 
this the errors are not that frequent .. but they are still there :( .. 
its still being modified by some other threads ...

Could you please let us know how do u intend to implement ur proposed 



Christoph Gaffga ( wrote:
> sorry, was to quick :((
> > So I decided to patch the DefaultIncludeCacheManager to work in the 
> same
> > way as the IncludeTransformer does, by setting up the child threads 
> with
> > the same context/environment:
> >
> >   // Setup this thread's environment
> >   RequestContextHolder.setRequestAttributes(
> >                             this.session.getRequestAttributes());
> >   EnvironmentHelper.enterProcessor(this.session.getProcessor(),
> >                             this.session.getEnvironment());
> >
> > I'll test this out, and if it work's I send in the patch.
> it does not help. It's the way it's meant to work, but it doesn't.
> Somehow the ObjectModels in the parallel running JXTemplateGenerators 
> affect each other and we have strange side affects on most of our 
> request.
> we are digging around, but no ideas any more how to fix it...
> any help would be appreciated.
> Christoph

View raw message