8209837: Avoid initializing ExpiringCache during bootstrap

Reviewed-by: sundar, forax
This commit is contained in:
Claes Redestad 2018-08-24 14:04:34 +02:00
parent 9ec15cedd0
commit 5ddac96c10
3 changed files with 39 additions and 21 deletions

View file

@ -231,18 +231,16 @@ abstract class FileSystem {
// Flags for enabling/disabling performance optimizations for file
// name canonicalization
static boolean useCanonCaches;
static boolean useCanonPrefixCache;
static final boolean useCanonCaches;
static final boolean useCanonPrefixCache;
private static boolean getBooleanProperty(String prop, boolean defaultVal) {
return Boolean.parseBoolean(System.getProperty(prop,
String.valueOf(defaultVal)));
String value = System.getProperty(prop);
return (value != null) ? Boolean.parseBoolean(value) : defaultVal;
}
static {
useCanonCaches = getBooleanProperty("sun.io.useCanonCaches",
useCanonCaches);
useCanonPrefixCache = getBooleanProperty("sun.io.useCanonPrefixCache",
useCanonPrefixCache);
useCanonCaches = getBooleanProperty("sun.io.useCanonCaches", false);
useCanonPrefixCache = useCanonCaches && getBooleanProperty("sun.io.useCanonPrefixCache", false);
}
}