users@jaxb.java.net

Re: Binding customization for "synchronized"

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Wed, 23 Apr 2003 07:21:52 -0700

One thing that I'm not sure is that when you have multiple threads
accessing the same data structure, you'd probably want more
coarse-grained lock, wouldn't you.

For example, when I have a list data structure (which consists of many
objects), then I'd want to lock the entire list, not just individual
cells in the list, before I start to modify it.

To me, the same thing holds with JAXB generated classes. It doesn't make
much sense to me to use "I'm modifying this object so don't touch it but
you can modify other objects freely" kind of lock. It would make more
sense to me to use "don't touch this region of the content tree" kind of
lock.

So in that case, I'd probably want to use a separate lock objects.

Is per-object lock really what you want?

regards,
--
Kohsuke KAWAGUCHI                  408-276-7063 (x17063)
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com