8229407: Avoid ConcurrentHashMap resizes during bootstrap
authorredestad
Mon, 12 Aug 2019 15:27:57 +0200
changeset 57714 9f44485e7441
parent 57713 0211b062843d
child 57715 6390e7056d12
8229407: Avoid ConcurrentHashMap resizes during bootstrap Reviewed-by: alanb, shade, dfuchs
src/java.base/share/classes/jdk/internal/loader/BuiltinClassLoader.java
src/java.base/share/classes/jdk/internal/module/ServicesCatalog.java
--- a/src/java.base/share/classes/jdk/internal/loader/BuiltinClassLoader.java	Mon Aug 12 11:24:53 2019 +0100
+++ b/src/java.base/share/classes/jdk/internal/loader/BuiltinClassLoader.java	Mon Aug 12 15:27:57 2019 +0200
@@ -183,7 +183,7 @@
         this.parent = parent;
         this.ucp = ucp;
 
-        this.nameToModule = new ConcurrentHashMap<>();
+        this.nameToModule = new ConcurrentHashMap<>(32);
         this.moduleToReader = new ConcurrentHashMap<>();
     }
 
--- a/src/java.base/share/classes/jdk/internal/module/ServicesCatalog.java	Mon Aug 12 11:24:53 2019 +0100
+++ b/src/java.base/share/classes/jdk/internal/module/ServicesCatalog.java	Mon Aug 12 15:27:57 2019 +0200
@@ -81,7 +81,7 @@
     }
 
     // service name -> list of providers
-    private final Map<String, List<ServiceProvider>> map = new ConcurrentHashMap<>();
+    private final Map<String, List<ServiceProvider>> map = new ConcurrentHashMap<>(32);
 
     private ServicesCatalog() { }