From: "James Strachan" <[EMAIL PROTECTED]> > From: "Morgan Delagrange" <[EMAIL PROTECTED]> > > 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. 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). However > once you have a Script you should be able to run it in several threads. > > 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. > > The org.apache.commons.jelly.impl package contains the Script implementation > classes, *Script.java, which should be thread safe. 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)
I've completed the work in this area now. The old TagScript, BeanTagScript and DynaTagScript have now rolled together into a single TagScript implementation. (This makes life much easier as a Tag at request time could dynamically resolve to a Tag bean or a DyanTag). Also the old non-threadsafe BeanTagScript is no more. So AFAIK the Scripts are all thread safe; there's only a few of them left now which should help ensure that thread-safety is preserved. 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: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>