Print this page


Split Close
Expand all
Collapse all
          --- old/src/share/classes/sun/rmi/server/WeakClassHashMap.java
          +++ new/src/share/classes/sun/rmi/server/WeakClassHashMap.java
↓ open down ↓ 38 lines elided ↑ open up ↑
  39   39   * being garbage collected if it is not otherwise strongly reachable.
  40   40   * The values are only softly reachable through this map, so that the
  41   41   * computed values generally persist while not otherwise strongly
  42   42   * reachable, but their storage may be reclaimed if necessary.  Also,
  43   43   * note that if a key is strongly reachable from a value, then the key
  44   44   * is effectively softly reachable through this map, which may delay
  45   45   * garbage collection of classes (see 4429536).
  46   46   **/
  47   47  public abstract class WeakClassHashMap<V> {
  48   48  
  49      -    private Map<Class<?>,ValueCell<V>> internalMap =
  50      -        new WeakHashMap<Class<?>,ValueCell<V>>();
       49 +    private Map<Class<?>,ValueCell<V>> internalMap = new WeakHashMap<>();
  51   50  
  52   51      protected WeakClassHashMap() { }
  53   52  
  54   53      public V get(Class<?> remoteClass) {
  55   54          /*
  56   55           * Use a mutable cell (a one-element list) to hold the soft
  57   56           * reference to a value, to allow the lazy value computation
  58   57           * to be synchronized with entry-level granularity instead of
  59   58           * by locking the whole table.
  60   59           */
↓ open down ↓ 28 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX