Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@apache.org Received: (qmail 56529 invoked from network); 2 Oct 2002 15:16:07 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 2 Oct 2002 15:16:07 -0000 Received: (qmail 22923 invoked by uid 97); 2 Oct 2002 15:16:11 -0000 Delivered-To: qmlist-jakarta-archive-commons-dev@jakarta.apache.org Received: (qmail 22759 invoked by uid 97); 2 Oct 2002 15:16:07 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 22261 invoked by uid 98); 2 Oct 2002 15:15:48 -0000 X-Antivirus: nagoya (v4218 created Aug 14 2002) Message-ID: <20021002151441.34018.qmail@web12404.mail.yahoo.com> Date: Wed, 2 Oct 2002 08:14:41 -0700 (PDT) From: Morgan Delagrange Reply-To: morgand@apache.org Subject: Re: [Jelly] Are Script objects supposed to be thread-safe? To: Jakarta Commons Developers List , morgand@apache.org In-Reply-To: <047201c269dd$5a34bdd0$9865fea9@spiritsoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Nice! More below... --- James Strachan wrote: > From: "Morgan Delagrange" > > Are compiled Script objects supposed to be > > thread-safe, or do I need to pool them? In either > > case, the answer should probably be documented in > the > > Javadocs. > > Scripts are *meant* to be thread safe. So each Tag > is thread local so that > the same Script can be run concurrently in several > threads. And new Tag are instantiated with every parse performed by a given thread? There is no danger of a Tag carrying over state from parse to parse, or is there? I hope not; clearing out state was always a big pain in taglibs, particularly since the spec has always worded the taglib lifecycle very poorly. > Note though that > the parsing of Scripts isn't thread safe; so only 1 > thread should parse a > Script at once (so the XMLParser could be > synchronized or pooled). Or you could use a fresh XMLParser every time, if you have a limited number of scripts to parse, right? I'm assuming that two instances of XMLParser can parse concurrently with no trouble. > However > once you have a Script you should be able to run it > in several threads. That's good to know. I wanted to prevent reading those > The JellyContext should be thread local; the aim is > to refactor the > JellyContext code a little so that it supports > pluggable variable Scopes, > then some synchronized shared Scopes can be used to > share state across > threads, while still having thread local Scopes too. That's what I assumed, cool. > The org.apache.commons.jelly.impl package contains > the Script implementation > classes, *Script.java, which should be thread safe. So, what's the plan here? That any implementation of Script should be thread-safe? If so, that should probably be noted in the Javadocs somewhere. If not, perhaps you should add a method like isThreadSafe() to the Script interface, so clients know whether or not they can hold onto compiled Scripts. > Though I think > BeanTagScript might not be threadsafe right now, it > might need a couple of > tweeks to ensure thread safety. FWIW I've been > meaning to simplify the code > in this part so that BeanTagScript, TagScript and > DynaTagScript merge > together into a single class capable of invoking at > runtime either a bean > Tag or a DynaTag and being thread safe) > > James > ------- > http://radio.weblogs.com/0112098/ > > __________________________________________________ > Do You Yahoo!? > Everything you'll ever need on one web page > from News and Sport to Email and Music Charts > http://uk.my.yahoo.com > > -- > To unsubscribe, e-mail: > > For additional commands, e-mail: > > ===== Morgan Delagrange http://jakarta.apache.org/taglibs http://jakarta.apache.org/commons http://axion.tigris.org http://jakarta.apache.org/watchdog __________________________________________________ Do you Yahoo!? New DSL Internet Access from SBC & Yahoo! http://sbc.yahoo.com -- To unsubscribe, e-mail: For additional commands, e-mail: