United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: 7093090 Reduce synchronization in java.security.Policy.getPolicyNoCheck
7093090 : Reduce synchronization in java.security.Policy.getPolicyNoCheck

Details
Type:
Bug
Submit Date:
2011-09-20
Status:
Resolved
Updated Date:
2012-05-11
Project Name:
JDK
Resolved Date:
2011-11-29
Component:
security-libs
OS:
solaris_10
Sub-Component:
java.security
CPU:
sparc
Priority:
P2
Resolution:
Fixed
Affected Versions:
7
Fixed Versions:
8

Related Reports
Backport:
Backport:
Backport:
Relates:
Relates:

Sub Tasks

Description
java.security.Policy.getPolicyNoCheck() is synchronized which causes some thread contention.

                                    

Comments
EVALUATION

The fix involved adding an initialized flag to indicate when the system-wide
policy has been initialized and storing both the flag and the Policy object in
an AtomicReference. Then, I also used the double-check locking idiom to avoid
locking the Policy class when the Policy had already been initialized.

Changeset: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/1945abeb82a0
                                     
2011-11-22



Hardware and Software, Engineered to Work Together