5266N/A * Copyright (c) 1998, 2012, 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 0N/A * published by the Free Software Foundation. 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 * @summary synopsis: Distributed Garbage Collection Deadlock 0N/A * @author Laird Dornin 0N/A * @library ../../testlibrary 5551N/A * @build TestLibrary Test TestImpl TestImpl_Stub 0N/A/* This test attempts to cause a deadlock between the rmi leaseChecker 0N/A * thread and a thread that is servicing a dgc clean call. Before the 0N/A * fix for this bug was implemented, deadlock could occur when the 0N/A * leaseChecker held the lock on the lease table and the clean thread 0N/A * held the lock on a target x. The clean thread would attempt to get 0N/A * the lock on the leaseTable to do DGCImpl.unregisterTarget and the 0N/A * leaseChecker would attempt to get the lock on x to do 0N/A * Target.vmidDead. Each thread held a resource that the other thread 0N/A * was attempting to lock. 0N/A * This test causes the above conditions to occur and waits to see if 169N/A * a given set of remote calls finishes "quickly enough." 169N/A " -Djava.rmi.dgc.leaseValue=500000" +
169N/A " -Dsun.rmi.dgc.checkInterval=" +
169N/A // wait for the remote calls to take place 169N/A " routines took too long to " +
169N/A // give the test remote object time to initialize. 169N/A // create a test client 169N/A /* give TestImpl time to lock the target in the 169N/A * object table and any dirtys finish. 169N/A //garbage collect and finalize foo 169N/A /* infinite loop to show the liveness of Client, 169N/A * if we have deadlock remote call will not return 169N/A for (
int i =
0; i <
500; i++) {
169N/A // flag exercises finished