RFR: 8145862: Improve lazy initialization of fields in java.net.URI

Claes Redestad claes.redestad at oracle.com
Tue Dec 22 16:13:04 UTC 2015


Hi,

please review this patch to clean up and remove volatile from a number 
of lazily initialized fields in java.net.URI. This is safe as long as 
the fields are always accessed through their accessors and the accessors 
return the local result of the calculation.

Since initialization was done with no synchronization, there was never 
any guarantee that different Strings couldn't escape from concurrent 
calls to these getters. So even if this becomes more likely by dropping 
volatile, this should be of no real consequence.

Bug: https://bugs.openjdk.java.net/browse/JDK-8145862
Webrev: http://cr.openjdk.java.net/~redestad/8145862/webrev.01

Thanks!

/Claes



More information about the core-libs-dev mailing list