JavaMemoryModel: Code in the JDK that fails under current memory model

From: Bill Pugh (pugh@cs.umd.edu)
Date: Mon Jul 12 1999 - 14:40:54 EDT


Has anyone put together a list of places
in the JDK that assume initialization safety?

Here are some I've found:

There are synchronized setFoo and matching unsynchronized getFoo
methods, operating on references, in:

java/awt/CheckboxGroup.set/get Current
java/awt/Component.set/get Cursor
java/awt/Dialog.set/get Title
java/awt/FileDialog.set/get FilenameFilter
java/awt/FocusManager.set/get FocusOwner
java/awt/Frame.set/get Title
java/awt/Frame.set/get IconImage
java/awt/MenuItem.set/get Label
java/lang/System.set/get SecurityManager
java/security/SecureRandom.set/get Seed
java/sql/DriverManager.set/get LogWriter
java/sql/DriverManager.set/get LogStream
java/sql/SQLException.set/get NextException
java/util/Locale.set/get Default
java/util/Properties.set/get Property
sun/net/www/MimeEntry.set/get ImageFileName

The double check idiom is used in:

        java/awt/Component.getName
        java/awt/MenuComponent.getName
        javax/swing/UIManager.getLAFState
        sun/awt/motif/X11InputMethod.dispatchComposedText

Using AssureJ, I found that the race for the set/get Cursor
in java.awt.Component does occur in practice.

        Bill Pugh
-------------------------------
This is the JavaMemoryModel mailing list, managed by Majordomo 1.94.4.

To send a message to the list, email JavaMemoryModel@cs.umd.edu
To send a request to the list, email majordomo@cs.umd.edu and put
your request in the body of the message (use the request "help" for help).
For more information, visit http://www.cs.umd.edu/~pugh/java/memoryModel



This archive was generated by hypermail 2b29 : Thu Oct 13 2005 - 07:00:16 EDT