Remove test dependencies on ReferenceQueue$Lock and Shutdown$Lock

This commit is contained in:
Eirik Bjorsnos 2026-01-27 22:08:47 +01:00
parent 932556026d
commit 6fddc7e6f6
5 changed files with 18 additions and 20 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2026, 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
@ -52,7 +52,7 @@ public class ClhsdbInspect {
System.out.println("Started LingeredApp with pid " + theApp.getPid());
// Run the 'jstack -v' command to get the address of a Method*,
// the oop address of a java.lang.ref.ReferenceQueue$Lock
// the oop address of a LingeredAppWithLock$NestedLock
// and the oop address of a java.lang.Class object
List<String> cmds = List.of("jstack -v");
@ -63,8 +63,8 @@ public class ClhsdbInspect {
tokensMap.put("(a java.lang.Class for LingeredAppWithLock)",
"instance of Oop for java/lang/Class");
tokensMap.put("Method*=", "Type is Method");
tokensMap.put("(a java.lang.ref.ReferenceQueue$Lock)",
"instance of Oop for java/lang/ref/ReferenceQueue\\$Lock");
tokensMap.put("(a LingeredAppWithLock$NestedLock)",
"instance of Oop for LingeredAppWithLock\\$NestedLock");
String[] lines = jstackOutput.split("\\R");

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2026, 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,6 +27,8 @@ import jdk.test.lib.apps.LingeredApp;
public class LingeredAppWithLock extends LingeredApp {
private static Object lockObj = new Object();
private static class NestedLock {}
public static void lockMethod(Object lock) {
synchronized (lock) {
try {
@ -50,12 +52,14 @@ public class LingeredAppWithLock extends LingeredApp {
public static void main(String args[]) {
Thread classLock1 = new Thread(() -> lockMethod(LingeredAppWithLock.class));
Thread classLock2 = new Thread(() -> lockMethod(LingeredAppWithLock.class));
Thread nestedClassLock = new Thread(() -> lockMethod(new NestedLock()));
Thread objectLock = new Thread(() -> lockMethod(classLock1));
Thread primitiveLock = new Thread(() -> lockMethod(int.class));
Thread objectWait = new Thread(() -> waitMethod());
classLock1.start();
classLock2.start();
nestedClassLock.start();
objectLock.start();
primitiveLock.start();
objectWait.start();
@ -65,6 +69,8 @@ public class LingeredAppWithLock extends LingeredApp {
classLock1.getState() != Thread.State.TIMED_WAITING) ||
(classLock2.getState() != Thread.State.BLOCKED &&
classLock2.getState() != Thread.State.TIMED_WAITING) ||
(nestedClassLock.getState() != Thread.State.BLOCKED &&
nestedClassLock.getState() != Thread.State.TIMED_WAITING) ||
(objectLock.getState() != Thread.State.TIMED_WAITING) ||
(primitiveLock.getState() != Thread.State.TIMED_WAITING) ||
(objectWait.getState() != Thread.State.TIMED_WAITING)) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2026, 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
@ -171,13 +171,9 @@ public class ConcurrentAssociateTest {
String lockName;
if ("Signal Dispatcher".equals(name))
continue;
if ("Reference Handler".equals(name)
&& (lockName = info.getLockName()) != null
&& lockName.startsWith("java.lang.ref.Reference$Lock"))
if ("Reference Handler".equals(name))
continue;
if ("Finalizer".equals(name)
&& (lockName = info.getLockName()) != null
&& lockName.startsWith("java.lang.ref.ReferenceQueue$Lock"))
if ("Finalizer".equals(name))
continue;
System.err.print(info);
}

View File

@ -434,11 +434,9 @@ public class Basic {
String name = info.getThreadName();
if ("Signal Dispatcher".equals(name))
continue;
if ("Reference Handler".equals(name)
&& info.getLockName().startsWith("java.lang.ref.Reference$Lock"))
if ("Reference Handler".equals(name))
continue;
if ("Finalizer".equals(name)
&& info.getLockName().startsWith("java.lang.ref.ReferenceQueue$Lock"))
if ("Finalizer".equals(name))
continue;
if (name.startsWith("process reaper"))
continue;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2025, 2026, 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
@ -447,7 +447,6 @@ public class ImageReaderBenchmark {
"/modules/java.base/jdk/internal/access/JavaLangRefAccess.class",
"/modules/java.base/java/lang/ref/ReferenceQueue.class",
"/modules/java.base/java/lang/ref/ReferenceQueue$Null.class",
"/modules/java.base/java/lang/ref/ReferenceQueue$Lock.class",
"/modules/java.base/jdk/internal/access/JavaLangAccess.class",
"/modules/java.base/jdk/internal/util/SystemProps.class",
"/modules/java.base/jdk/internal/util/SystemProps$Raw.class",
@ -1073,6 +1072,5 @@ public class ImageReaderBenchmark {
"/modules/java.base/java/nio/charset/CoderResult.class",
"/modules/java.base/java/util/IdentityHashMap$IdentityHashMapIterator.class",
"/modules/java.base/java/util/IdentityHashMap$KeyIterator.class",
"/modules/java.base/java/lang/Shutdown.class",
"/modules/java.base/java/lang/Shutdown$Lock.class");
"/modules/java.base/java/lang/Shutdown.class");
}