< prev index next >

src/java.base/share/classes/java/security/SecureClassLoader.java

Print this page
@@ -29,10 +29,11 @@
  
  import java.util.Map;
  import java.util.Objects;
  import java.util.concurrent.ConcurrentHashMap;
  import java.util.function.Function;
+ import jdk.internal.misc.CDS;
  
  /**
   * This class extends {@code ClassLoader} with additional support for defining
   * classes with an associated code source and permissions.
   *

@@ -240,8 +241,17 @@
  
      /**
       * Called by the VM, during -Xshare:dump
       */
      private void resetArchivedStates() {
-         pdcache.clear();
+         if (CDS.isDumpingProtectionDomains()) {
+             if (System.getProperty("cds.debug.archived.protection.domains") != null) {
+                 for (Map.Entry<CodeSourceKey, ProtectionDomain> entry : pdcache.entrySet()) {
+                     CodeSourceKey key = entry.getKey();
+                     System.out.println("Archiving ProtectionDomain " + key.cs + " for " + this);
+                 }
+             }            
+         } else {
+             pdcache.clear();
+         }
      }
  }
< prev index next >