diff --git a/closed/src/java.base/share/classes/java/io/ClassCache.java b/closed/src/java.base/share/classes/java/io/ClassByNameCache.java
similarity index 88%
rename from closed/src/java.base/share/classes/java/io/ClassCache.java
rename to closed/src/java.base/share/classes/java/io/ClassByNameCache.java
index 6f894d55a78..aa8d29c79d3 100644
--- a/closed/src/java.base/share/classes/java/io/ClassCache.java
+++ b/closed/src/java.base/share/classes/java/io/ClassByNameCache.java
@@ -1,13 +1,13 @@
/*
-* ===========================================================================
-* (c) Copyright IBM Corp. 2017, 2019 All Rights Reserved
-* ===========================================================================
- *
+ * ===========================================================================
+ * (c) Copyright IBM Corp. 2017, 2022 All Rights Reserved
+ * ===========================================================================
+ *
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
+ * published by the Free Software Foundation.
*
- * IBM designates this particular file as subject to the "Classpath" exception
+ * IBM designates this particular file as subject to the "Classpath" exception
* as provided by IBM in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
@@ -18,9 +18,9 @@
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, see .
- *
+ *
* ===========================================================================
-*/
+ */
package java.io;
@@ -30,19 +30,18 @@
import java.security.PrivilegedAction;
import java.util.Objects;
import java.util.concurrent.ConcurrentHashMap;
-/* ClassCache is Primarily responsible for Caching the results of the className lookups and hence to avoid
+/* ClassByNameCache is Primarily responsible for Caching the results of the className lookups and hence to avoid
* multiple Lookup for same Class Instance.
- * ClassCache provides a ConcurrentHash based ClassCache which is looked up prior to calling the class.forName
+ * ClassByNameCache provides a ConcurrentHash based ClassByNameCache which is looked up prior to calling the class.forName
* Method resolveClass() from ObjectInputStream uses this Cache.
- *
+ *
* Caching is done only when the actually used loader for a Class is one of the Sytem loaders (ie) App Class Loader,
- * System Extension loader and BootStrap loader
- *
+ * System Extension loader and BootStrap loader.
*/
-final class ClassCache {
+final class ClassByNameCache {
/* Main Cache for storing the Class.forName results Here Key used would be CacheKey */
private final ConcurrentHashMap cache =
- new ConcurrentHashMap();
+ new ConcurrentHashMap();
/* Initiating Loader to CacheKey mapping in the Cache used by Reaper thread for removal on stale Loaders */
private final ConcurrentHashMap loaderKeys =
new ConcurrentHashMap();
@@ -56,9 +55,9 @@ final class ClassCache {
* Constructor Populates Canonical Loader Refs with System Loader Entries and initializes the reaper thread which
* monitors the ReferenceQueue for stale loaders
*/
-
- public ClassCache() {
- ClassLoader loader = ClassLoader.getSystemClassLoader();
+
+ public ClassByNameCache() {
+ ClassLoader loader = ClassLoader.getSystemClassLoader();
while (loader != null) {
setCanonicalSystemLoaderRef(loader);
loader = loader.getParent();
@@ -75,7 +74,7 @@ private void setCanonicalSystemLoaderRef(ClassLoader loader) {
LoaderRef newKey = new LoaderRef(loader, staleLoaderRefs, true);
assert (canonicalLoaderRefs.put(newKey, newKey) == null);
}
-
+
/*
* get Canonical Loader reference for the loader
*/
@@ -108,7 +107,7 @@ void removeStaleRef(LoaderRef loaderRef) {
}
/*
- * Identifies if the loader used to load is one of the system loaders,
+ * Identifies if the loader used to load is one of the system loaders,
* if so updates the cache and the LoaderKey, and also a StaleLoaderReference for the initiating LoaderObject
* via LoaderRef Constructor
*/
@@ -137,7 +136,7 @@ void update(CacheKey key, Class> result) {
}
}
/*
- * Creates a New Entry in the Cache
+ * Creates a New Entry in the Cache
*/
private Object createEntry(CacheKey key) {
FutureValue newValue = new FutureValue(key, this); //Does actual call to class.forName as required.
@@ -146,7 +145,7 @@ private Object createEntry(CacheKey key) {
return value;
}
/*
- * This is the entry point in to the cache from ObjectInputStream. First Lookup is done based on the className and Loader
+ * This is the entry point in to the cache from ObjectInputStream. First Lookup is done based on the className and Loader
*/
public Class> get(String className, ClassLoader loader)
throws ClassNotFoundException {
@@ -157,13 +156,13 @@ public Class> get(String className, ClassLoader loader)
}
if (value instanceof FutureValue) {
-
+
return ((FutureValue)value).get();
}
return (Class>)value;
}
-
+
/*
* FutureValue implements Future Mechanics that is required for addressing contention issues in the HashMap
*/
@@ -171,10 +170,10 @@ public Class> get(String className, ClassLoader loader)
private static final class FutureValue {
private final CacheKey key;
private final LoaderRef loaderRef;
- private final ClassCache cache;
+ private final ClassByNameCache cache;
private Class> value = null;
- FutureValue(CacheKey key, ClassCache cache) {
+ FutureValue(CacheKey key, ClassByNameCache cache) {
this.key = key;
this.loaderRef = key.loaderRef;
this.cache = cache;
@@ -200,27 +199,27 @@ Class> get() throws ClassNotFoundException {
private static final class CreateReaperAction
implements PrivilegedAction {
- private final ClassCache cache;
+ private final ClassByNameCache cache;
private final ReferenceQueue