users@jaxb.java.net

Re: Synchronized Methods Extension

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Thu, 10 Jul 2003 08:46:19 -0700

Good to know that it is useful.

"Franklin, Brian" <brian.franklin_at_ciraden.com> wrote:
> Of course, while satisfied, the customer always wants more. 8-} So I have
> another suggestion for how to enhance it. When the synchronized methods
> extension is active, could all elements that were Lists be initialized with
> "... = Collections.synchronizedList( new ListImpl(new ArrayList()) );"
> instead of just the ListImpl?
>
> As it is, any time the contents of one of those List properties is accessed
> (for an add/remove/etc), you have to be sure to synchronize on it. The
> Collections.synchronizedList wrapping would at least narrow that down so
> that you only have to synchronize on the List when iterating.
>
> Let me know what you think, and thanks again for the feature.

I think you could simply write:

    <globalBindings collectionType="java.util.Vector" />

Vector is synchronized, so this should work.

It would be nicer if we could somehow achive the same effect
automatically when the extension is used, but I'm afraid that would be
difficult.

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