commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simone Tripodi <simonetrip...@apache.org>
Subject Re: [Betwixt] is betwixt thread safe ?
Date Sun, 14 Aug 2011 18:24:23 GMT
Hi Patrick!!!
for the XML -> Object mapping, Betwixt relies on Digester, which is
NOT thread safe.
You have 3 options:

 - synchronize the blocks as you did - anyway it's not the best way IMHO;
 - re-create the deserializer for each request;
 - use Betwixt in combination with commons-pool, get/release a
deserializer for each request (same pattern you would do with JDBC
Connection in a DataSource).

My preferred is the #3, but it's just a matter of tastes ;)
Have a nice day, all the best!!!
Simo

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



On Sat, Aug 13, 2011 at 8:31 PM, patrick daures
<patrick.daures@gmail.com> wrote:
> Hi, i'm currently using betwixt in produit to serialize and unserialize
> objects in XML. Each thread is using a new instance of beanreader to
> unserialize XML. I had a problem with my application, i added a synchronized
> around the call to the betwixt lib and everything went fine. Maybe the
> problem comes from my app, but i wanted to be sure the lib is thread safe.
> Thanks.
>

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


Mime
View raw message