On Fri, 2008-08-22 at 08:18 -0400, Vadim Gritsenko wrote: > On Aug 22, 2008, at 3:35 AM, Thorsten Scherler wrote: > > > How about: > > } else { > > - Object lock = > > env.getObjectModel().get(HttpEnvironment.HTTP_REQUEST_OBJECT); > > + Object lock = > > env.getObjectModel().get(ObjectModelHelper.REQUEST_OBJECT); > > try { > > transientStore.store(lockKey, lock); > > } catch (IOException e) { > > > > This way we always lock the same object. > > Exactly this thing I was trying to explain - it will not work because > instead of using top level request you are suggesting to use current > sub-request.
Sorry I am not really following. As understand you we cannot use ObjectModelHelper.REQUEST_OBJECT since we cannot be sure that is not a sub-request (a request for the exact same resource in a concurrent situation). If the lock is null for a HttpEnvironment.HTTP_REQUEST_OBJECT then we are in CLI mode. In CLI ASAIK there is no concurrent situation meaning the problem cannot occur. However since the issue is talking about includes that may occur. Having a typical call from the cli gives for the env.getObjectModel(): HashMap values: [null, [EMAIL PROTECTED], link-collection=[], [EMAIL PROTECTED], null, null, null, null, [EMAIL PROTECTED], null, null, [EMAIL PROTECTED], [EMAIL PROTECTED], null, null, null] So which object you would suggest to lock? You wrote "Suitable alternative would be to lock against top most command line request." To what you are referring with "top most command line request"? salu2 > > Take a look at EnvironmentWrapper (which is used e.g. in SitemapSource): > > // create new object model and replace the request object > Map oldObjectModel = env.getObjectModel(); > if (oldObjectModel instanceof HashMap) { > this.objectModel = (Map)((HashMap)oldObjectModel).clone(); > } else { > this.objectModel = new HashMap(oldObjectModel.size()*2); > Iterator entries = oldObjectModel.entrySet().iterator(); > Map.Entry entry; > while (entries.hasNext()) { > entry = (Map.Entry)entries.next(); > this.objectModel.put(entry.getKey(), entry.getValue()); > } > } > this.request = new > RequestWrapper(ObjectModelHelper.getRequest(oldObjectModel), > requestURI, > queryString, > this, > rawMode); > this.objectModel.put(ObjectModelHelper.REQUEST_OBJECT, > this.request); > > > Vadim -- Thorsten Scherler thorsten.at.apache.org Open Source Java consulting, training and solutions