mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-15 13:49:42 +02:00
7191877: TEST_BUG: java/rmi/transport/checkLeaseInfoLeak/CheckLeaseLeak.java failing intermittently
Reviewed-by: smarks, coffeys
This commit is contained in:
parent
db12f1934a
commit
5a442197d2
3 changed files with 44 additions and 59 deletions
|
@ -615,8 +615,6 @@ java/rmi/server/Unreferenced/finiteGCLatency/FiniteGCLatency.java 7140992 generi
|
|||
|
||||
java/rmi/transport/rapidExportUnexport/RapidExportUnexport.java 7146541 linux-all
|
||||
|
||||
java/rmi/transport/checkLeaseInfoLeak/CheckLeaseLeak.java 7191877 generic-all
|
||||
|
||||
java/rmi/registry/readTest/CodebaseTest.java 8173324 windows-all
|
||||
java/rmi/registry/multipleRegistries/MultipleRegistries.java 8268182 macosx-all
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2025, 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
|
||||
|
@ -54,12 +54,11 @@
|
|||
|
||||
import java.rmi.*;
|
||||
import java.rmi.server.*;
|
||||
import sun.rmi.transport.*;
|
||||
import sun.rmi.*;
|
||||
import java.util.Map;
|
||||
import java.io.*;
|
||||
import java.lang.reflect.*;
|
||||
import java.rmi.registry.*;
|
||||
import sun.rmi.transport.*;
|
||||
|
||||
public class CheckLeaseLeak extends UnicastRemoteObject implements LeaseLeak {
|
||||
public CheckLeaseLeak() throws RemoteException { }
|
||||
|
@ -102,8 +101,6 @@ public class CheckLeaseLeak extends UnicastRemoteObject implements LeaseLeak {
|
|||
System.err.println("Created client: " + i);
|
||||
|
||||
JavaVM jvm = new JavaVM("LeaseLeakClient",
|
||||
" -Djava.security.policy=" +
|
||||
TestParams.defaultPolicy +
|
||||
" -Drmi.registry.port=" +
|
||||
registryPort,
|
||||
"");
|
||||
|
@ -128,8 +125,8 @@ public class CheckLeaseLeak extends UnicastRemoteObject implements LeaseLeak {
|
|||
}
|
||||
}
|
||||
|
||||
/* numLeft should be 2 - if 11 there is a problem. */
|
||||
if (numLeft > 2) {
|
||||
/* numLeft should be 4 - if 11 there is a problem. */
|
||||
if (numLeft > 4) {
|
||||
TestLibrary.bomb("Too many objects in DGCImpl.leaseTable: "+
|
||||
numLeft);
|
||||
} else {
|
||||
|
@ -156,57 +153,51 @@ public class CheckLeaseLeak extends UnicastRemoteObject implements LeaseLeak {
|
|||
Field f;
|
||||
|
||||
try {
|
||||
f = (Field) java.security.AccessController.doPrivileged
|
||||
(new java.security.PrivilegedExceptionAction() {
|
||||
public Object run() throws Exception {
|
||||
ObjID dgcID = new ObjID(DGC_ID);
|
||||
/*
|
||||
* Construct an ObjectEndpoint containing DGC's
|
||||
* ObjID.
|
||||
*/
|
||||
Class oeClass =
|
||||
Class.forName("sun.rmi.transport.ObjectEndpoint");
|
||||
Class[] constrParams =
|
||||
new Class[]{ ObjID.class, Transport.class };
|
||||
Constructor oeConstructor =
|
||||
oeClass.getDeclaredConstructor(constrParams);
|
||||
oeConstructor.setAccessible(true);
|
||||
Object oe =
|
||||
oeConstructor.newInstance(
|
||||
new Object[]{ dgcID, null });
|
||||
|
||||
ObjID dgcID = new ObjID(DGC_ID);
|
||||
/*
|
||||
* Get Target that contains DGCImpl in ObjectTable
|
||||
*/
|
||||
Class objTableClass =
|
||||
Class.forName("sun.rmi.transport.ObjectTable");
|
||||
Class getTargetParams[] = new Class[] { oeClass };
|
||||
Method objTableGetTarget =
|
||||
objTableClass.getDeclaredMethod("getTarget",
|
||||
getTargetParams);
|
||||
objTableGetTarget.setAccessible(true);
|
||||
Target dgcTarget = (Target)
|
||||
objTableGetTarget.invoke(null, new Object[]{ oe });
|
||||
|
||||
/*
|
||||
* Construct an ObjectEndpoint containing DGC's
|
||||
* ObjID.
|
||||
*/
|
||||
Class oeClass =
|
||||
Class.forName("sun.rmi.transport.ObjectEndpoint");
|
||||
Class[] constrParams =
|
||||
new Class[]{ ObjID.class, Transport.class };
|
||||
Constructor oeConstructor =
|
||||
oeClass.getDeclaredConstructor(constrParams);
|
||||
oeConstructor.setAccessible(true);
|
||||
Object oe =
|
||||
oeConstructor.newInstance(
|
||||
new Object[]{ dgcID, null });
|
||||
|
||||
/*
|
||||
* Get Target that contains DGCImpl in ObjectTable
|
||||
*/
|
||||
Class objTableClass =
|
||||
Class.forName("sun.rmi.transport.ObjectTable");
|
||||
Class getTargetParams[] = new Class[] { oeClass };
|
||||
Method objTableGetTarget =
|
||||
objTableClass.getDeclaredMethod("getTarget",
|
||||
getTargetParams);
|
||||
objTableGetTarget.setAccessible(true);
|
||||
Target dgcTarget = (Target)
|
||||
objTableGetTarget.invoke(null, new Object[]{ oe });
|
||||
|
||||
/* get the DGCImpl from its Target */
|
||||
Method targetGetImpl =
|
||||
dgcTarget.getClass().getDeclaredMethod
|
||||
/* get the DGCImpl from its Target */
|
||||
Method targetGetImpl =
|
||||
dgcTarget.getClass().getDeclaredMethod
|
||||
("getImpl", null);
|
||||
targetGetImpl.setAccessible(true);
|
||||
dgcImpl[0] =
|
||||
(Remote) targetGetImpl.invoke(dgcTarget, null);
|
||||
targetGetImpl.setAccessible(true);
|
||||
dgcImpl[0] =
|
||||
(Remote) targetGetImpl.invoke(dgcTarget, null);
|
||||
|
||||
/* Get the lease table from the DGCImpl. */
|
||||
Field reflectedLeaseTable =
|
||||
dgcImpl[0].getClass().getDeclaredField
|
||||
/* Get the lease table from the DGCImpl. */
|
||||
Field reflectedLeaseTable =
|
||||
dgcImpl[0].getClass().getDeclaredField
|
||||
("leaseTable");
|
||||
reflectedLeaseTable.setAccessible(true);
|
||||
reflectedLeaseTable.setAccessible(true);
|
||||
|
||||
f = reflectedLeaseTable;
|
||||
|
||||
return reflectedLeaseTable;
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* This is the leaseTable that will fill up with LeaseInfo
|
||||
|
@ -217,9 +208,6 @@ public class CheckLeaseLeak extends UnicastRemoteObject implements LeaseLeak {
|
|||
numLeaseInfosLeft = leaseTable.size();
|
||||
|
||||
} catch(Exception e) {
|
||||
if (e instanceof java.security.PrivilegedActionException)
|
||||
e = ((java.security.PrivilegedActionException) e).
|
||||
getException();
|
||||
TestLibrary.bomb(e);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2025, 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
|
||||
|
@ -27,7 +27,6 @@ import java.rmi.registry.*;
|
|||
|
||||
public class LeaseLeakClient {
|
||||
public static void main(String args[]) {
|
||||
TestLibrary.suggestSecurityManager("java.rmi.RMISecurityManager");
|
||||
|
||||
try {
|
||||
LeaseLeak leaseLeak = null;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue