/** * Increments the "keep-alive count". * * The "keep-alive count" is the number of non-permanent remote objects * that are either in the object table or still have calls in progress. * Therefore, this method should be invoked exactly once for every * non-permanent remote object exported (a remote object must be * exported before it can have any calls in progress). * * The VM is "kept alive" while the keep-alive count is greater than * zero; this is accomplished by keeping a non-daemon thread running. * * Because non-permanent objects are those that can be garbage * collected while exported, and thus those for which the "reaper" * thread operates, the reaper thread also serves as the non-daemon * VM keep-alive thread; a new reaper thread is created if necessary. */ static void incrementKeepAliveCount() { synchronized (keepAliveLock) { keepAliveCount++; if (reaper == null) { reaper = AccessController.doPrivileged( new NewThreadAction(new Reaper(), "Reaper", false)); reaper.start(); } /* * While there are non-"permanent" objects in the object table, * request a maximum latency for inspecting the entire heap * from the local garbage collector, to place an upper bound * on the time to discover remote objects that have become * unreachable (and thus can be removed from the table). */ if (gcLatencyRequest == null) { gcLatencyRequest = GC.requestLatency(gcInterval); } } }
/** * Look up the EndpointEntry for the given Endpoint. An entry is * created if one does not already exist. */ public static EndpointEntry lookup(Endpoint ep) { synchronized (endpointTable) { EndpointEntry entry = endpointTable.get(ep); if (entry == null) { entry = new EndpointEntry(ep); endpointTable.put(ep, entry); /* * While we are tracking live remote references registered * in this VM, request a maximum latency for inspecting the * entire heap from the local garbage collector, to place * an upper bound on the time to discover remote references * that have become unreachable (see bugid 4171278). */ if (gcLatencyRequest == null) { gcLatencyRequest = GC.requestLatency(gcInterval); } } return entry; } }
/** * Look up the EndpointEntry for the given Endpoint. An entry is * created if one does not already exist. */ public static EndpointEntry lookup(Endpoint ep) { synchronized (endpointTable) { EndpointEntry entry = (EndpointEntry) endpointTable.get(ep); if (entry == null) { entry = new EndpointEntry(ep); endpointTable.put(ep, entry); /* * While we are tracking live remote references registered * in this VM, request a maximum latency for inspecting the * entire heap from the local garbage collector, to place * an upper bound on the time to discover remote references * that have become unreachable (see bugid 4171278). */ if (gcLatencyRequest == null) { gcLatencyRequest = GC.requestLatency(gcInterval); } } return entry; } }