[jdom-interest] static data needs to be thread data for
jhunter at acm.org
Thu Sep 21 13:52:19 PDT 2000
> However where the class has hidden static data (such as
> Namespace.namespaces)the class must be responsible for making
> access to this thread safe otherwise multithreaded applications
> such as your typical Web or EJB case, have no choice but to single
> thread all use of the JDOM packages
> :(. This would lead to appalling performance in any realistic use.
> At present multihreaded use of Namespace.getNamespace even
> indirectly (eg by
> importing files in different threads) will cause random failures with
I agree. You should be able to have different threads in the same JVM
using JDOM to create different documents without having collisions
between them. Each document needs external sync, but you shouldn't need
to get a global lock before reading a new document. In other words, I
agree we should sync access to static variables but leaving instance
variables unsync'd. Any disagreement?
Nick, do you want to submit a patch to Namespace that makes access to
the statics sync'd?
More information about the jdom-interest