users@jaxb.java.net

marshalling thread safety

From: Trevor Kramer <tkramer_at_hampshire.edu>
Date: Fri, 15 Sep 2006 13:55:49 -0700

If I have a set of java classes annotated with @XmlAccessorType
(FIELD) which I need to access from multiple threads is there any way
other than throwing a giant lock around all accesses to the data
classes to ensure correct thread visibility? If I ensure that all
methods on the classes are synchronized this will make sure that all
threads using the classes see changes made by other threads - but If
I want to run a jaxb marshall in another thread since it uses
reflection does it grab each objects lock before reading the fields -
and if not then is there a way to ensure changes made by other
threads are visible to the jaxb thread without resorting to a giant
lock around all the classes?

Thanks,

Trevor