45 * space. 46 * 47 * @author Ann Wollrath 48 * @author Peter Jones 49 */ 50 public final class ObjectTable { 51 52 /** maximum interval between complete garbage collections of local heap */ 53 private final static long gcInterval = // default 1 hour 54 AccessController.doPrivileged( 55 new GetLongAction("sun.rmi.dgc.server.gcInterval", 3600000)); 56 57 /** 58 * lock guarding objTable and implTable. 59 * Holders MAY acquire a Target instance's lock or keepAliveLock. 60 */ 61 private static final Object tableLock = new Object(); 62 63 /** tables mapping to Target, keyed from ObjectEndpoint and impl object */ 64 private static final Map<ObjectEndpoint,Target> objTable = 65 new HashMap<ObjectEndpoint,Target>(); 66 private static final Map<WeakRef,Target> implTable = 67 new HashMap<WeakRef,Target>(); 68 69 /** 70 * lock guarding keepAliveCount, reaper, and gcLatencyRequest. 71 * Holders may NOT acquire a Target instance's lock or tableLock. 72 */ 73 private static final Object keepAliveLock = new Object(); 74 75 /** count of non-permanent objects in table or still processing calls */ 76 private static int keepAliveCount = 0; 77 78 /** thread to collect unreferenced objects from table */ 79 private static Thread reaper = null; 80 81 /** queue notified when weak refs in the table are cleared */ 82 static final ReferenceQueue reapQueue = new ReferenceQueue(); 83 84 /** handle for GC latency request (for future cancellation) */ 85 private static GC.LatencyRequest gcLatencyRequest = null; 86 87 /* 88 * Disallow anyone from creating one of these. 89 */ 90 private ObjectTable() {} 91 92 /** 93 * Returns the target associated with the object id. 94 */ 95 static Target getTarget(ObjectEndpoint oe) { 96 synchronized (tableLock) { 97 return objTable.get(oe); 98 } 99 } 100 101 /** 102 * Returns the target associated with the remote object | 45 * space. 46 * 47 * @author Ann Wollrath 48 * @author Peter Jones 49 */ 50 public final class ObjectTable { 51 52 /** maximum interval between complete garbage collections of local heap */ 53 private final static long gcInterval = // default 1 hour 54 AccessController.doPrivileged( 55 new GetLongAction("sun.rmi.dgc.server.gcInterval", 3600000)); 56 57 /** 58 * lock guarding objTable and implTable. 59 * Holders MAY acquire a Target instance's lock or keepAliveLock. 60 */ 61 private static final Object tableLock = new Object(); 62 63 /** tables mapping to Target, keyed from ObjectEndpoint and impl object */ 64 private static final Map<ObjectEndpoint,Target> objTable = 65 new HashMap<>(); 66 private static final Map<WeakRef,Target> implTable = 67 new HashMap<>(); 68 69 /** 70 * lock guarding keepAliveCount, reaper, and gcLatencyRequest. 71 * Holders may NOT acquire a Target instance's lock or tableLock. 72 */ 73 private static final Object keepAliveLock = new Object(); 74 75 /** count of non-permanent objects in table or still processing calls */ 76 private static int keepAliveCount = 0; 77 78 /** thread to collect unreferenced objects from table */ 79 private static Thread reaper = null; 80 81 /** queue notified when weak refs in the table are cleared */ 82 static final ReferenceQueue<Object> reapQueue = new ReferenceQueue<>(); 83 84 /** handle for GC latency request (for future cancellation) */ 85 private static GC.LatencyRequest gcLatencyRequest = null; 86 87 /* 88 * Disallow anyone from creating one of these. 89 */ 90 private ObjectTable() {} 91 92 /** 93 * Returns the target associated with the object id. 94 */ 95 static Target getTarget(ObjectEndpoint oe) { 96 synchronized (tableLock) { 97 return objTable.get(oe); 98 } 99 } 100 101 /** 102 * Returns the target associated with the remote object |