changeset 56496:9f44485e7441

8229407: Avoid ConcurrentHashMap resizes during bootstrap Reviewed-by: alanb, shade, dfuchs
author redestad
date Mon, 12 Aug 2019 15:27:57 +0200
parents 0211b062843d
children 6390e7056d12
files src/java.base/share/classes/jdk/internal/loader/BuiltinClassLoader.java src/java.base/share/classes/jdk/internal/module/ServicesCatalog.java
diffstat 2 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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() { }