1 10 11 package com.triactive.jdo.util; 12 13 import java.lang.ref.ReferenceQueue ; 14 import java.lang.ref.SoftReference ; 15 import java.util.Map ; 16 17 18 32 33 public class SoftValueMap extends ReferenceValueMap 34 { 35 public SoftValueMap() 36 { 37 super(); 38 } 39 40 41 public SoftValueMap(int initialCapacity) 42 { 43 super(initialCapacity); 44 } 45 46 47 public SoftValueMap(int initialCapacity, float loadFactor) 48 { 49 super(initialCapacity, loadFactor); 50 } 51 52 53 public SoftValueMap(Map m) 54 { 55 super(m); 56 } 57 58 59 private static class SoftValueReference extends SoftReference implements ReferenceValueMap.ValueReference 60 { 61 private final Object key; 62 63 SoftValueReference(Object key, Object value, ReferenceQueue q) 64 { 65 super(value, q); 66 this.key = key; 67 } 68 69 public Object getKey() 70 { 71 return key; 72 } 73 } 74 75 protected ReferenceValueMap.ValueReference newValueReference(Object key, Object value, ReferenceQueue queue) 76 { 77 return new SoftValueReference(key, value, queue); 78 } 79 } 80 | Popular Tags |