test/java/rmi/transport/dgcDeadLock/DGCDeadLock.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 1998, 2008, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
--- 1,7 ----
/*
! * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*** 30,39 ****
--- 30,40 ----
* @library ../../testlibrary
* @build DGCDeadLock
* @build Test
* @build TestImpl
* @build TestImpl_Stub
+ * @build TestLibrary
* @run main/othervm/policy=security.policy/timeout=360 DGCDeadLock
*/
/* This test attempts to cause a deadlock between the rmi leaseChecker
* thread and a thread that is servicing a dgc clean call. Before the
*** 51,61 ****
import java.rmi.*;
import java.io.*;
public class DGCDeadLock implements Runnable {
!
final static public int HOLD_TARGET_TIME = 25000;
public static int TEST_FAIL_TIME = HOLD_TARGET_TIME + 30000;
public static boolean finished = false;
static DGCDeadLock test = new DGCDeadLock();
--- 52,62 ----
import java.rmi.*;
import java.io.*;
public class DGCDeadLock implements Runnable {
! private static final int REGISTRY_PORT = TestLibrary.getUnusedRandomPort();
final static public int HOLD_TARGET_TIME = 25000;
public static int TEST_FAIL_TIME = HOLD_TARGET_TIME + 30000;
public static boolean finished = false;
static DGCDeadLock test = new DGCDeadLock();
*** 73,83 ****
try {
String options = " -Djava.security.policy=" +
TestParams.defaultPolicy +
" -Djava.rmi.dgc.leaseValue=500000" +
" -Dsun.rmi.dgc.checkInterval=" +
! (HOLD_TARGET_TIME - 5000) + "";
testImplVM = new JavaVM("TestImpl", options, "");
testImplVM.start();
synchronized (test) {
--- 74,86 ----
try {
String options = " -Djava.security.policy=" +
TestParams.defaultPolicy +
" -Djava.rmi.dgc.leaseValue=500000" +
" -Dsun.rmi.dgc.checkInterval=" +
! (HOLD_TARGET_TIME - 5000) +
! " -Drmi.registry.port=" + REGISTRY_PORT +
! "" ;
testImplVM = new JavaVM("TestImpl", options, "");
testImplVM.start();
synchronized (test) {
*** 110,120 ****
// give the test remote object time to initialize.
Thread.currentThread().sleep(8000);
// create a test client
Test foo = (Test) Naming.lookup("rmi://:" +
! TestLibrary.REGISTRY_PORT +
"/Foo");
echo = foo.echo("Hello world");
System.err.println("Test object created.");
/* give TestImpl time to lock the target in the
--- 113,123 ----
// give the test remote object time to initialize.
Thread.currentThread().sleep(8000);
// create a test client
Test foo = (Test) Naming.lookup("rmi://:" +
! REGISTRY_PORT +
"/Foo");
echo = foo.echo("Hello world");
System.err.println("Test object created.");
/* give TestImpl time to lock the target in the
*** 129,139 ****
Runtime.getRuntime().gc();
Runtime.getRuntime().runFinalization();
//import "Bar"
Test bar = (Test) Naming.lookup("rmi://:" +
! TestLibrary.REGISTRY_PORT +
"/Bar");
/* infinite loop to show the liveness of Client,
* if we have deadlock remote call will not return
*/
--- 132,142 ----
Runtime.getRuntime().gc();
Runtime.getRuntime().runFinalization();
//import "Bar"
Test bar = (Test) Naming.lookup("rmi://:" +
! REGISTRY_PORT +
"/Bar");
/* infinite loop to show the liveness of Client,
* if we have deadlock remote call will not return
*/