commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <>
Subject Re: [Jelly] Are Script objects supposed to be thread-safe?
Date Wed, 02 Oct 2002 06:31:32 GMT
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. 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, *, 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)


Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message