Disposer.java revision 1886
0N/A * Copyright 2002-2005 Sun Microsystems, Inc. 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 0N/A * published by the Free Software Foundation. Sun designates this 0N/A * particular file as subject to the "Classpath" exception as provided 0N/A * by Sun 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. 0N/A * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 0N/A * CA 95054 USA or visit www.sun.com if you need additional information or 0N/A * have any questions. 0N/A * This class is used for registering and disposing the native 0N/A * data associated with java objects. 0N/A * The object can register itself by calling one of the addRecord 0N/A * methods and providing either the pointer to the native disposal 0N/A * method or a descendant of the DisposerRecord class with overridden 0N/A * When the object becomes unreachable, the dispose() method 0N/A * of the associated DisposerRecord object will be called. 0N/A * @see DisposerRecord 0N/A /* The thread must be a member of a thread group 0N/A * which will not get GCed before VM exit. 0N/A * Make its parent the top-level thread group. 0N/A * Registers the object and the native data for later disposal. 0N/A * @param target Object to be registered 0N/A * @param disposeMethod pointer to the native disposal method 0N/A * @param pData pointer to the data to be passed to the 0N/A * native disposal method 0N/A * Registers the object and the native data for later disposal. 0N/A * @param target Object to be registered 0N/A * @param rec the associated DisposerRecord object 0N/A * @see DisposerRecord 0N/A * Performs the actual registration of the target object to be disposed. 0N/A * @param target Object to be registered, or if target is an instance 0N/A * of DisposerTarget, its associated disposer referent 0N/A * will be the Object that is registered 0N/A * @param rec the associated DisposerRecord object 0N/A * @see DisposerRecord 1886N/A * This is a marker interface that, if implemented, means it 1886N/A * doesn't acquire any special locks, and is safe to 1886N/A * be disposed in the poll loop on whatever thread 1886N/A * which happens to be the Toolkit thread, is in use. 1886N/A * Set to indicate the queue is presently being polled. 1886N/A * The pollRemove() method is called back from a dispose method 1886N/A * that is running on the toolkit thread and wants to 1886N/A * dispose any pending refs that are safe to be disposed 1886N/A /* This should never be called recursively, so this check 1886N/A * is just a safeguard against the unexpected. 0N/A * This was added for use by the 2D font implementation to avoid creation 0N/A * of an additional disposer thread. 0N/A * WARNING: this thread class monitors a specific queue, so a reference 0N/A * added here must have been created with this queue. Failure to do 0N/A * so will clutter the records hashmap and no one will be cleaning up 0N/A * the reference queue. 0N/A /* This is intended for use in conjunction with addReference(..)