[jdom-interest] Re: JDOM thread safety

Joseph Bowbeer jozart at csi.com
Sun Aug 13 17:27:40 PDT 2000

> I agree, although I'd say "synchronized
> when necessary"

If you study the description of why double-check locking is
broken, I think you'll see that synchronization is necessary most
of the time.

Java permits writes to be reordered (in a very non-object-oriented
way). This means that a reference to an object may be visible to
another thread before the updates associated with the contents of
that object are visible.

I recommend synchronizing now.  It will be easier to maintain in
the long run.

As for the cost of synchronization, it has been steadily

As for weak references, that seems like a good idea, though thread
safety is still an issue, I believe.

Joe Bowbeer

More information about the jdom-interest mailing list