jdk/src/share/classes/java/lang/Thread.java
changeset 7803 56bc97d69d93
parent 7540 df3383a0e30d
child 7816 55a18147b4bf
equal deleted inserted replaced
7802:74f2ee2b62ba 7803:56bc97d69d93
  1640         }
  1640         }
  1641 
  1641 
  1642         // Get a snapshot of the list of all threads
  1642         // Get a snapshot of the list of all threads
  1643         Thread[] threads = getThreads();
  1643         Thread[] threads = getThreads();
  1644         StackTraceElement[][] traces = dumpThreads(threads);
  1644         StackTraceElement[][] traces = dumpThreads(threads);
  1645         Map<Thread, StackTraceElement[]> m
  1645         Map<Thread, StackTraceElement[]> m = new HashMap<>(threads.length);
  1646             = new HashMap<Thread, StackTraceElement[]>(threads.length);
       
  1647         for (int i = 0; i < threads.length; i++) {
  1646         for (int i = 0; i < threads.length; i++) {
  1648             StackTraceElement[] stackTrace = traces[i];
  1647             StackTraceElement[] stackTrace = traces[i];
  1649             if (stackTrace != null) {
  1648             if (stackTrace != null) {
  1650                 m.put(threads[i], stackTrace);
  1649                 m.put(threads[i], stackTrace);
  1651             }
  1650             }
  1662     /* Replace with ConcurrentReferenceHashMap when/if it appears in a future
  1661     /* Replace with ConcurrentReferenceHashMap when/if it appears in a future
  1663      * release */
  1662      * release */
  1664     private static class Caches {
  1663     private static class Caches {
  1665         /** cache of subclass security audit results */
  1664         /** cache of subclass security audit results */
  1666         static final ConcurrentMap<WeakClassKey,Boolean> subclassAudits =
  1665         static final ConcurrentMap<WeakClassKey,Boolean> subclassAudits =
  1667             new ConcurrentHashMap<WeakClassKey,Boolean>();
  1666             new ConcurrentHashMap<>();
  1668 
  1667 
  1669         /** queue for WeakReferences to audited subclasses */
  1668         /** queue for WeakReferences to audited subclasses */
  1670         static final ReferenceQueue<Class<?>> subclassAuditsQueue =
  1669         static final ReferenceQueue<Class<?>> subclassAuditsQueue =
  1671             new ReferenceQueue<Class<?>>();
  1670             new ReferenceQueue<>();
  1672     }
  1671     }
  1673 
  1672 
  1674     /**
  1673     /**
  1675      * Verifies that this (possibly subclass) instance can be constructed
  1674      * Verifies that this (possibly subclass) instance can be constructed
  1676      * without violating security constraints: the subclass must not override
  1675      * without violating security constraints: the subclass must not override