2362N/A * Copyright (c) 1996, 2008, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2362N/A * or visit www.oracle.com if you need additional information or have any 0N/A * A target contains information pertaining to a remote object that 0N/A * resides in this address space. Targets are located via the 0N/A /** object id for target */ 0N/A /** flag indicating whether target is subject to collection */ 0N/A /** weak reference to remote object implementation */ 0N/A /** dispatcher for remote object */ 0N/A /** stub for remote object */ 0N/A /** set of clients that hold references to this target */ 0N/A /** table that maps client endpoints to sequence numbers */ 0N/A /** access control context in which target was created */ 0N/A /** context class loader in which target was created */ 0N/A /** true if this target has been removed from the object table */ 0N/A * the transport through which this target was exported and 0N/A * through which remote calls will be allowed 0N/A /** number to identify next callback thread created here */ 0N/A * Construct a Target for a remote object "impl" with 0N/A * a specific object id. 0N/A * If "permanent" is true, then the impl is pinned permanently 0N/A * (the impl will not be collected via distributed and/or local 0N/A * GC). If "on" is false, than the impl is subject to 0N/A * collection. Permanent objects do not keep a server from 0N/A * Fix for 4149366: so that downloaded parameter types unmarshalled 0N/A * for this impl will be compatible with types known only to the 0N/A * impl class's class loader (when it's not identical to the 0N/A * exporting thread's context class loader), mark the impl's class 0N/A * loader as the loader to use as the context class loader in the 0N/A * server's dispatch thread while a call to this impl is being 0N/A * processed (unless this exporting thread's context class loader is 0N/A * a child of the impl's class loader, such as when a registry is 0N/A * exported by an application, in which case this thread's context 0N/A * class loader is preferred). 0N/A * Return true if the first class loader is a child of (or identical 0N/A * to) the second class loader. Either loader may be "null", which is 0N/A * considered to be the parent of any non-null class loader. 0N/A * (utility method added for the 1.2beta4 fix for 4149366) 0N/A /** Get the stub (proxy) object for this target 0N/A * Returns the object endpoint for the target. 0N/A * Get the weak reference for the Impl of this target. 0N/A * Returns the dispatcher for this remote object target. 0N/A * Get the impl for this target. 0N/A * Note: this may return null if the impl has been garbage collected. 0N/A * (currently, there is no need to make this method public) 0N/A * Returns true if the target is permanent. 0N/A * Pin impl in target. Pin the WeakRef object so it holds a strong 0N/A * reference to the object to it will not be garbage collected locally. 0N/A * This way there is a single object responsible for the weak ref 0N/A * Unpin impl in target. Weaken the reference to impl so that it 0N/A * can be garbage collected locally. But only if there the refSet 0N/A * a) impl is not permanent, and 0N/A * b) impl is not already unpinned, and 0N/A * c) there are no external references (outside this 0N/A * address space) for the impl 0N/A * Enable the transport through which remote calls to this target 0N/A * are allowed to be set if it has not already been set. 0N/A * Add an endpoint to the remembered set. Also adds a notifier 0N/A * to call back if the address space associated with the endpoint 0N/A // check sequence number for vmid 0N/A // late dirty call; ignore. 0N/A * A Target must be pinned while its refSet is not empty. It may 0N/A * have become unpinned if external LiveRefs only existed in 0N/A * serialized form for some period of time, or if a client failed 0N/A * to renew its lease due to a transient network failure. So, 0N/A * make sure that it is pinned here; this fixes bugid 4069644. 0N/A * Remove endpoint from remembered set. If set becomes empty, 0N/A * remove server from Transport's object table. 0N/A // check sequence number for vmid 0N/A // late clean call; ignore 0N/A // strong clean call; retain sequenceNum 0N/A // get rid of sequence number 0N/A * Remove endpoint from the reference set. 0N/A // remove notification request 0N/A // reference set is empty, so server can be garbage collected. 0N/A // remove object from table. 0N/A "reference set is empty: target = " +
this);
0N/A * If the remote object implements the Unreferenced interface, 0N/A * invoke its unreferenced callback in a separate thread. 0N/A // REMIND: access to nextThreadNum not synchronized; you care? 0N/A * We must manually set the context class loader appropriately 0N/A * for threads that may invoke user code (see bugid 4171278). 0N/A * Mark this target as not accepting new calls if any of the 0N/A * following conditions exist: a) the force parameter is true, 0N/A * b) the target's call count is zero, or c) the object is already 0N/A * not accepting calls. Returns true if target is marked as not 0N/A * accepting new calls; returns false otherwise. 0N/A * Fix for 4331349: unpin object so that it may be gc'd. 0N/A * Also, unregister all vmids referencing this target 0N/A * so target can be gc'd. 0N/A * Mark this target as having been removed from the object table. 0N/A * Increment call count. 0N/A * Decrement call count. 0N/A throw new Error(
"internal error: call count less than zero");
0N/A * The "keep-alive count" is the number of non-permanent remote 0N/A * objects that are either in the object table or still have calls 0N/A * in progress. Therefore, this state change may affect the 0N/A * keep-alive count: if this target is for a non-permanent remote 0N/A * object that has been removed from the object table and now has a 0N/A * call count of zero, it needs to be decremented. 0N/A * Returns true if remembered set is empty; otherwise returns 0N/A * This method is called if the address space associated with the 0N/A * vmid dies. In that case, the vmid should be removed 0N/A * from the reference set.