diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/interrupt/interrupt001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/interrupt/interrupt001.java index 7fe3059acb8..a1e347b5b73 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/interrupt/interrupt001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/interrupt/interrupt001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2023, 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 @@ -47,11 +47,9 @@ import java.io.*; * The test is passed if both 'interrupted status" are equal,
* otherwise the test failed.
*
- * The test consists of two cases as follows:
+ * The test consists of one test case as follows:
* - both debuggee's threads are locked up at synchronized block and
* are not suspended;
- * - both debuggee's threads are locked up at synchronized block and
- * are suspended by java.lang.Thread.suspend() method;
*/ public class interrupt001 { @@ -211,7 +209,9 @@ public class interrupt001 { throw new TestBug("ERROR: Not found ThreadReference for name :" + threadName2); } - log2("......interrupting the thread2"); + log2("......thread2 is " + (thread2.isVirtual() ? "" : "not ") + "a virtual thread"); + + log2("......interrupting thread2"); thread2.interrupt(); log2("......instructing main thread to check up threads' interrupted statuses"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/interrupt/interrupt001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/interrupt/interrupt001a.java index c3a8bbea6b8..aef7c02161c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/interrupt/interrupt001a.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/interrupt/interrupt001a.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2023, 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 @@ -65,9 +65,9 @@ public class interrupt001a { // scaffold objects private static volatile ArgumentHandler argumentHandler = null; - private static interrupt001aThread thread2 = null; + private static Thread thread2 = null; - private static interrupt001aThread thread3 = null; + private static Thread thread3 = null; private static IOPipe pipe; @@ -102,7 +102,7 @@ public class interrupt001a { } else if (instruction.equals("newcheck")) { - synchronized (interrupt001aThread.lockingObject) { + synchronized (interrupt001aTask.lockingObject) { thread2 = threadStart("Thread02"); thread3 = threadStart("Thread03"); @@ -142,14 +142,15 @@ public class interrupt001a { System.exit(exitCode + PASS_BASE); } - private static interrupt001aThread threadStart(String threadName) { - interrupt001aThread resultThread = new interrupt001aThread(threadName); - synchronized (resultThread.waitnotifyObj) { + private static Thread threadStart(String threadName) { + interrupt001aTask resultRunnable = new interrupt001aTask(threadName); + Thread resultThread = JDIThreadFactory.newThread(resultRunnable, threadName); + synchronized (resultRunnable.waitnotifyObj) { resultThread.start(); try { log1(" before: waitnotifyObj.wait();"); - while (!resultThread.ready) - resultThread.waitnotifyObj.wait(); + while (!resultRunnable.ready) + resultRunnable.waitnotifyObj.wait(); log1(" after: waitnotifyObj.wait();"); } catch (InterruptedException e) { logErr("Unexpected InterruptedException while waiting for start of : " + threadName); @@ -205,10 +206,10 @@ public class interrupt001a { } } -class interrupt001aThread extends Thread { +class interrupt001aTask extends NamedTask { - public interrupt001aThread(String threadName) { - super(threadName); + public interrupt001aTask(String taskName) { + super(taskName); } public boolean ready; @@ -235,6 +236,6 @@ class interrupt001aThread extends Thread { } void log(String str) { - interrupt001a.log2(Thread.currentThread().getName() + " : " + str); + interrupt001a.log2(getName() + " : " + str); } }