[concurrency-interest] Significance of volatile static

Doug Lea dl at cs.oswego.edu
Mon Jun 27 19:42:18 EDT 2011

On 06/22/11 19:59, Boehm, Hans wrote:
> (A version of the slides are at
> http://www.hpl.hp.com/personal/Hans_Boehm/misc_slides/java_finalizers.pdf .

> As far as I know, a real fix for this has unfortunately never made it into the
> language specification. (Doug?) Doug had a proposal as part of the fence
> proposal. But I think it ended up as collateral damage of that debate. T

I should have mentioned that if you define your own version
of reachabilityFence in the way suggested on Hans's slides:
     public static void reachabilityFence(Object ref) {
         synchronized (ref) {}

Then all of the remarks about reachabilityFence in the
unreleased Fences API javadoc hold for it.
This might for now be the best course of action.
Hopefully someday a more efficient implementation of such a method
will be supported in some class, somewhere.

And even as it stands, this is not usually a terrible
implementation -- most objects requiring reachability
fences are not parts of contention bottlenecks.


More information about the Concurrency-interest mailing list