Hi,
mixing volatiles and non-volatiles fields that are read and written to
outside of
synchronized makes me somewhat queasy...
Instead of a volatile boolean and a mutable userDir field, couldn't this
just
as well be modelled as:
- keep userDir final (always the not normalized value of
System.getProperty("user.dir"))
- replace volatile boolean isUserDirNormal with volatile String
normalizedUserDir
- then implement the DCL in getUserPath like:
String normalizedUserDir = this.normalizedUserDir;
if (normalizedUserDir == null) {
synchronized(userDir) {
if (normalizedUserDir == null) {
normalizedUserDir = this.normalizedUserDir =
normalize(userDir);
}
}
}
return normalizedUserDir;
WDYT?
/Claes
On 2018-03-12 19:32, Brian Burkhalter wrote:
https://bugs.openjdk.java.net/browse/JDK-8198997
http://cr.openjdk.java.net/~bpb/8198997/webrev.00/
Lazily cache the value of the user.dir property on first access. This change is
for Windows only as there does not appear to be any percentage in doing
something similar on Unix.
Thanks,
Brian