--- a/jdk/src/java.base/share/classes/java/lang/ClassLoader.java Mon Apr 11 16:46:52 2016 +0900
+++ b/jdk/src/java.base/share/classes/java/lang/ClassLoader.java Mon Apr 11 10:55:03 2016 +0200
@@ -2625,6 +2625,25 @@
// the ServiceCatalog for modules associated with this class loader.
private volatile ServicesCatalog servicesCatalog;
+ /**
+ * Returns the ConcurrentHashMap used as a storage for ClassLoaderValue(s)
+ * associated with this ClassLoader, creating it if it doesn't already exist.
+ */
+ ConcurrentHashMap<?, ?> createOrGetClassLoaderValueMap() {
+ ConcurrentHashMap<?, ?> map = classLoaderValueMap;
+ if (map == null) {
+ map = new ConcurrentHashMap<>();
+ boolean set = trySetObjectField("classLoaderValueMap", map);
+ if (!set) {
+ // beaten by someone else
+ map = classLoaderValueMap;
+ }
+ }
+ return map;
+ }
+
+ // the storage for ClassLoaderValue(s) associated with this ClassLoader
+ private volatile ConcurrentHashMap<?, ?> classLoaderValueMap;
/**
* Attempts to atomically set a volatile field in this object. Returns