commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simone Tripodi <simonetrip...@apache.org>
Subject Re: svn commit: r1301177 - /commons/proper/digester/trunk/core/src/main/java/org/apache/commons/digester3/binder/AbstractRulesModule.java
Date Fri, 16 Mar 2012 08:02:26 GMT
Hi Seb!

> If the problem is due to multi-threading issues, isn't that because
> the same instance is being shared between threads, presumably on
> purpose?
>

while it is known that the Digester is not thread-safety, the
DigesterLoader (that corresponds to its Factory, or Builder) shall
allow users creating different Digester instances without concurrency
issues: the loader describes the Digester rules only once, then will
create different Digester instances with same Rule types, but not same
Rule instances.

The user that submitted the issue reported his use-case where he
initializes the DigesterLoader when a Servlet starts, then create a
Digester for each request, it's here where the issue happens because
the Loader actually takes in consideration setting-up a Digester
instance at time, without locking or queuing the requests.

> If so, using ThreadLocal may fix the immediate problem, but won't it
> prevent the data being shared?

fortunately there is no need to share data across multiple threads,
the objects lyfecycle is very simple[1] and it is just a matter of
creating a DigesterLoader using a list of RulesModule, each of them
uses a RulesBinder to set new Rule instances to a new Digester
instance, when creating it on demand.

If you have suggestions, they will be more than welcome :)

thanks for reviewing, very appreciated!
best
-Simo

[1] http://commons.apache.org/digester/guide/binder.html

http://people.apache.org/~simonetripodi/
http://simonetripodi.livejournal.com/
http://twitter.com/simonetripodi
http://www.99soft.org/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message