From 2b716d7b32d745fa135f479c5a236517e87014e2 Mon Sep 17 00:00:00 2001 From: Leonid Mesnik Date: Fri, 10 Apr 2026 18:21:44 +0000 Subject: [PATCH] 8381658: Update nsk/jvmti/scenarios/sampling to better test virtual threads Reviewed-by: cjplummer, sspitsyn --- .../scenarios/allocation/AP04/ap04t001.java | 7 +- .../scenarios/allocation/AP04/ap04t002.java | 7 +- .../scenarios/allocation/AP04/ap04t003.java | 7 +- .../scenarios/bcinstr/BI04/bi04t002.java | 5 +- .../scenarios/contention/TC04/tc04t001.java | 5 +- .../jvmti/scenarios/events/EM02/em02t001.java | 7 +- .../jvmti/scenarios/events/EM02/em02t003.java | 8 +- .../EM02/em02t003/loadclass/em02t003a.java | 5 +- .../EM02/em02t005/loadclass/em02t005a.java | 5 +- .../jvmti/scenarios/events/EM02/em02t008.java | 9 +- .../jvmti/scenarios/events/EM05/em05t001.java | 5 +- .../jvmti/scenarios/events/EM05/em05t002.java | 5 +- .../jvmti/scenarios/events/EM07/em07t002.java | 10 +- .../EM07/em07t002/loadclass/em07t002a.java | 5 +- .../scenarios/hotswap/HS101/hs101t001.java | 5 +- .../scenarios/hotswap/HS101/hs101t002.java | 5 +- .../scenarios/hotswap/HS101/hs101t003.java | 5 +- .../scenarios/hotswap/HS101/hs101t004.java | 5 +- .../scenarios/hotswap/HS101/hs101t005.java | 5 +- .../scenarios/hotswap/HS101/hs101t006.java | 5 +- .../scenarios/hotswap/HS101/hs101t007.java | 5 +- .../scenarios/hotswap/HS101/hs101t008.java | 5 +- .../scenarios/hotswap/HS102/hs102t001.java | 5 +- .../scenarios/hotswap/HS102/hs102t002.java | 5 +- .../hotswap/HS103/hs103t002/MyThread.java | 6 +- .../HS103/hs103t002/newclass00/MyThread.java | 6 +- .../hotswap/HS104/hs104t002/MyThread.java | 5 +- .../HS104/hs104t002/newclass00/MyThread.java | 5 +- .../scenarios/hotswap/HS201/hs201t001.java | 7 +- .../scenarios/hotswap/HS201/hs201t002.java | 12 +- .../scenarios/hotswap/HS201/hs201t003.java | 6 +- .../hotswap/HS202/hs202t001/MyThread.java | 7 +- .../hotswap/HS202/hs202t001/hs202t001.java | 6 +- .../HS202/hs202t001/newclass00/MyThread.java | 7 +- .../hotswap/HS202/hs202t002/MyThread.java | 7 +- .../hotswap/HS202/hs202t002/hs202t002.java | 8 +- .../HS202/hs202t002/newclass00/MyThread.java | 7 +- .../hotswap/HS203/hs203t001/MyThread.java | 6 +- .../hotswap/HS203/hs203t001/hs203t001.java | 6 +- .../HS203/hs203t001/newclass00/MyThread.java | 6 +- .../hotswap/HS203/hs203t002/MyThread.java | 6 +- .../hotswap/HS203/hs203t002/hs203t002.java | 12 +- .../HS203/hs203t002/newclass00/MyThread.java | 6 +- .../hotswap/HS203/hs203t003/MyThread.java | 6 +- .../hotswap/HS203/hs203t003/hs203t003.java | 8 +- .../HS203/hs203t003/newclass00/MyThread.java | 6 +- .../hotswap/HS203/hs203t004/MyThread.java | 6 +- .../hotswap/HS203/hs203t004/hs203t004.java | 8 +- .../HS203/hs203t004/newclass00/MyThread.java | 6 +- .../hotswap/HS204/hs204t002/MyThread.java | 7 +- .../HS204/hs204t002/newclass00/MyThread.java | 7 +- .../hotswap/HS204/hs204t003/MyThread.java | 6 +- .../hotswap/HS204/hs204t003/hs204t003.java | 7 +- .../HS204/hs204t003/newclass00/MyThread.java | 7 +- .../hotswap/HS204/hs204t004/hs204t004.java | 8 +- .../scenarios/multienv/MA03/ma03t001.java | 5 +- .../scenarios/sampling/SP01/sp01t001.java | 19 +- .../sampling/SP01/sp01t001/sp01t001.cpp | 4 +- .../nsk/share/ExtraClassesBuilder.java | 4 +- test/lib/jdk/test/lib/Utils.java | 7 +- .../jdk/test/lib/thread/ThreadWrapper.java | 246 ++++++++++++++++++ 61 files changed, 489 insertions(+), 149 deletions(-) create mode 100644 test/lib/jdk/test/lib/thread/ThreadWrapper.java diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP04/ap04t001.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP04/ap04t001.java index df80009d315..1a539f4d37b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP04/ap04t001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP04/ap04t001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 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 @@ -26,6 +26,7 @@ package nsk.jvmti.scenarios.allocation.AP04; import java.io.*; import java.lang.reflect.*; +import jdk.test.lib.thread.ThreadWrapper; import nsk.share.*; import nsk.share.jvmti.*; @@ -114,7 +115,7 @@ public class ap04t001 extends DebugeeClass { log.display("All objects collected"); log.display("Wait for thread to finish"); - joinThread(thread); + joinThread(thread.getThread()); log.display("CASE #" + caseName + " finished.\n"); } @@ -172,7 +173,7 @@ class ap04t001SomeReachachableObjectsIterator implements ap04t001Iterator { } /**************************************************************************/ -class ap04t001Thread extends Thread { +class ap04t001Thread extends ThreadWrapper { String name; ap04t001Iterator iterator; Wicket startLock; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP04/ap04t002.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP04/ap04t002.java index 9ecadf22f08..962474e0d01 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP04/ap04t002.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP04/ap04t002.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 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 @@ -26,6 +26,7 @@ package nsk.jvmti.scenarios.allocation.AP04; import java.io.*; import java.lang.reflect.*; +import jdk.test.lib.thread.ThreadWrapper; import nsk.share.*; import nsk.share.jvmti.*; @@ -100,7 +101,7 @@ public class ap04t002 extends DebugeeClass { modified++; log.display("Wait for completion thread to finish"); - joinThread(thread); + joinThread(thread.getThread()); log.display("Cleaning tags and references to objects..."); for (int i = 0; i < OBJ_MAX_COUNT; i++) { if (root[i] != null) { @@ -166,7 +167,7 @@ class ap04t002SomeReachachableObjectsIterator implements ap04t002Iterator { } /**************************************************************************/ -class ap04t002Thread extends Thread { +class ap04t002Thread extends ThreadWrapper { String name; ap04t002Iterator iterator; Wicket startLock; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP04/ap04t003.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP04/ap04t003.java index 15e7aa1c63a..60ca7cea837 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP04/ap04t003.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP04/ap04t003.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 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 @@ -26,6 +26,7 @@ package nsk.jvmti.scenarios.allocation.AP04; import java.io.*; import java.lang.reflect.*; +import jdk.test.lib.thread.ThreadWrapper; import nsk.share.*; import nsk.share.jvmti.*; @@ -98,7 +99,7 @@ public class ap04t003 extends DebugeeClass { ap04t003Thread thread = startThread( threadName, iterator); log.display("Wait for thread to finish"); - joinThread(thread); + joinThread(thread.getThread()); log.display("Cleaning tags and references to objects..."); for (int i = 0; i < OBJ_MAX_COUNT; i++) { if (root[i] != null) { @@ -164,7 +165,7 @@ class ap04t003SomeReachachableObjectsIterator implements ap04t003Iterator { } /**************************************************************************/ -class ap04t003Thread extends Thread { +class ap04t003Thread extends ThreadWrapper { String name; ap04t003Iterator iterator; Wicket startLock; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI04/bi04t002.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI04/bi04t002.java index 87a0de5d31d..db5ddf45a7c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI04/bi04t002.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI04/bi04t002.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 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 @@ -30,6 +30,7 @@ import nsk.share.Consts; import nsk.share.jvmti.ArgumentHandler; import nsk.share.jvmti.DebugeeClass; +import jdk.test.lib.thread.ThreadWrapper; public class bi04t002 extends DebugeeClass { @@ -118,7 +119,7 @@ public class bi04t002 extends DebugeeClass { } } -class bi04t002b extends Thread { +class bi04t002b extends ThreadWrapper { Object obj = new Object(); static Object started = new Object(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC04/tc04t001.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC04/tc04t001.java index 0707f38b4dd..2aa37d5d4ce 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC04/tc04t001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC04/tc04t001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 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 @@ -28,6 +28,7 @@ import java.util.concurrent.*; import nsk.share.*; import nsk.share.jvmti.*; +import jdk.test.lib.thread.ThreadWrapper; public class tc04t001 extends DebugeeClass { @@ -92,7 +93,7 @@ public class tc04t001 extends DebugeeClass { /* =================================================================== */ -class tc04t001Thread extends Thread { +class tc04t001Thread extends ThreadWrapper { final static int INCREMENT_LIMIT = 100; final static int DELAY = 1000; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t001.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t001.java index 9f92bf5423e..c37f0649067 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 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,7 @@ import java.io.PrintStream; import nsk.share.*; import nsk.share.jvmti.*; +import jdk.test.lib.thread.ThreadWrapper; public class em02t001 extends DebugeeClass { @@ -65,7 +66,7 @@ public class em02t001 extends DebugeeClass { logger.display("Timeout = " + timeout + " msc."); for (int i = 0; i < 3; i++) { - debuggeeThread = new em02t001Thread("Debuggee Thread"); + debuggeeThread = new em02t001Thread("Debuggee Thread").getThread(); generateEvents(); @@ -113,7 +114,7 @@ public class em02t001 extends DebugeeClass { } // tested threads - class em02t001Thread extends Thread { + class em02t001Thread extends ThreadWrapper { public em02t001Thread(String name) { super(name); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t003.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t003.java index a23732dc554..0914b0129f2 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t003.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t003.java @@ -33,6 +33,8 @@ import nsk.share.jvmti.*; import java.util.*; import java.math.*; +import jdk.test.lib.thread.ThreadWrapper; + public class em02t003 extends DebugeeClass { // run test from command line @@ -74,7 +76,7 @@ public class em02t003 extends DebugeeClass { } Class loadedClass; - Thread thrd; + ThreadWrapper thrd; ClassUnloader unloader = new ClassUnloader(); for (int i = 0; i < 3; i++) { @@ -90,7 +92,7 @@ public class em02t003 extends DebugeeClass { loadedClass = unloader.getLoadedClass(); try { - thrd = (Thread )loadedClass.newInstance(); + thrd = ((ThreadWrapper)loadedClass.newInstance()); } catch (Exception e) { logger.complain("Unexpected exception " + e); e.printStackTrace(); @@ -139,7 +141,7 @@ public class em02t003 extends DebugeeClass { return status; } - boolean invokeMethod(Class cls, Thread thrd, String methodName) { + boolean invokeMethod(Class cls, ThreadWrapper thrd, String methodName) { Method method; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t003/loadclass/em02t003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t003/loadclass/em02t003a.java index 32150e99ed6..8b11a8cd961 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t003/loadclass/em02t003a.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t003/loadclass/em02t003a.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 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 @@ -22,8 +22,9 @@ */ package nsk.jvmti.scenarios.events.EM02; +import jdk.test.lib.thread.ThreadWrapper; -public class em02t003a extends Thread { +public class em02t003a extends ThreadWrapper { public void run() { // invoke methods in a loop to provoke compilation diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t005/loadclass/em02t005a.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t005/loadclass/em02t005a.java index ee340084946..89bd00f5f83 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t005/loadclass/em02t005a.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t005/loadclass/em02t005a.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 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 @@ -22,8 +22,9 @@ */ package nsk.jvmti.scenarios.events.EM02; +import jdk.test.lib.thread.ThreadWrapper; -public class em02t005a extends Thread { +public class em02t005a extends ThreadWrapper { public void em02t005a() { } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t008.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t008.java index 7e30300c41b..a5a7e4298fe 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t008.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t008.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 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,7 @@ import java.io.PrintStream; import nsk.share.*; import nsk.share.jvmti.*; +import jdk.test.lib.thread.ThreadWrapper; public class em02t008 extends DebugeeClass { @@ -55,7 +56,7 @@ public class em02t008 extends DebugeeClass { int status = Consts.TEST_PASSED; long timeout = argHandler.getWaitTime() * 60000; // milliseconds - Thread thrd1, thrd2; + ThreadWrapper thrd1, thrd2; for (int i = 0; i < STEP_NUMBER; i++) { thrd1 = new em02t008a(); @@ -79,7 +80,7 @@ public class em02t008 extends DebugeeClass { return status; } - class em02t008a extends Thread{ + class em02t008a extends ThreadWrapper { em02t008a() { setName("em02t008a"); @@ -90,7 +91,7 @@ public class em02t008 extends DebugeeClass { } } - class em02t008b extends Thread{ + class em02t008b extends ThreadWrapper { em02t008b() { setName("em02t008b"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM05/em05t001.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM05/em05t001.java index 3fa8e076729..11a7efd6bd8 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM05/em05t001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM05/em05t001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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,7 @@ import java.io.PrintStream; import nsk.share.*; import nsk.share.jvmti.*; +import jdk.test.lib.thread.ThreadWrapper; public class em05t001 extends DebugeeClass { @@ -95,7 +96,7 @@ public class em05t001 extends DebugeeClass { /* =================================================================== */ // tested threads -class em05t001Thread extends Thread { +class em05t001Thread extends ThreadWrapper { public void run() { // invoke methods in a loop to provoke compilation for (int i = 0; i < 100; i++) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM05/em05t002.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM05/em05t002.java index 011f03e8cc0..378d770dd06 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM05/em05t002.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM05/em05t002.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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,7 @@ import java.io.PrintStream; import nsk.share.*; import nsk.share.jvmti.*; +import jdk.test.lib.thread.ThreadWrapper; public class em05t002 extends DebugeeClass { @@ -98,7 +99,7 @@ public class em05t002 extends DebugeeClass { /* =================================================================== */ // tested threads -class em05t002Thread extends Thread { +class em05t002Thread extends ThreadWrapper { public void run() { // invoke methods in a loop to provoke compilation for (int i = 0; i < 100; i++) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM07/em07t002.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM07/em07t002.java index dcaca552073..852549276ec 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM07/em07t002.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM07/em07t002.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 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 @@ -31,6 +31,8 @@ import java.io.File; import nsk.share.*; import nsk.share.jvmti.*; +import jdk.test.lib.thread.ThreadWrapper; + /** * Test executes the following scenario to check events COMPILED_METHOD_LOAD, * COMPILED_METHOD_UNLOAD: @@ -118,7 +120,7 @@ public class em07t002 extends DebugeeClass { String path = args[0]; Class loadedClass; - Thread thrd; + ThreadWrapper thrd; ClassUnloader unloader = new ClassUnloader(); for (int i = 0; i < attempts; i++) { logger.display("======================================"); @@ -136,7 +138,7 @@ public class em07t002 extends DebugeeClass { loadedClass = unloader.getLoadedClass(); try { - thrd = (Thread )loadedClass.newInstance(); + thrd = (ThreadWrapper)loadedClass.newInstance(); } catch (Exception e) { logger.complain("Unexpected exception " + e); e.printStackTrace(); @@ -170,7 +172,7 @@ public class em07t002 extends DebugeeClass { return status; } - boolean invokeMethod(Class cls, Thread thrd, String methodName) { + boolean invokeMethod(Class cls, ThreadWrapper thrd, String methodName) { Method method; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM07/em07t002/loadclass/em07t002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM07/em07t002/loadclass/em07t002a.java index 3f03fd95568..dc3abe49296 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM07/em07t002/loadclass/em07t002a.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM07/em07t002/loadclass/em07t002a.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 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 @@ -22,8 +22,9 @@ */ package nsk.jvmti.scenarios.events.EM07; +import jdk.test.lib.thread.ThreadWrapper; -public class em07t002a extends Thread { +public class em07t002a extends ThreadWrapper { public void run() { // invoke methods in a loop to provoke compilation diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS101/hs101t001.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS101/hs101t001.java index 21fc0a0e158..b3c1c25833c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS101/hs101t001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS101/hs101t001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 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 @@ -25,6 +25,7 @@ package nsk.jvmti.scenarios.hotswap.HS101; import java.io.PrintStream; +import jdk.test.lib.thread.ThreadWrapper; import nsk.share.*; import nsk.share.jvmti.*; @@ -115,7 +116,7 @@ public class hs101t001 extends DebugeeClass { /* =================================================================== */ -class hs101t001Thread extends Thread { +class hs101t001Thread extends ThreadWrapper { public Wicket startingBarrier = new Wicket(); private volatile boolean flag = true; public int i; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS101/hs101t002.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS101/hs101t002.java index 368ed04a01e..e654dde6db0 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS101/hs101t002.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS101/hs101t002.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 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 @@ -25,6 +25,7 @@ package nsk.jvmti.scenarios.hotswap.HS101; import java.io.PrintStream; +import jdk.test.lib.thread.ThreadWrapper; import nsk.share.*; import nsk.share.jvmti.*; @@ -115,7 +116,7 @@ public class hs101t002 extends DebugeeClass { /* =================================================================== */ -class hs101t002Thread extends Thread { +class hs101t002Thread extends ThreadWrapper { public Wicket startingBarrier = new Wicket(); private volatile boolean flag = true; public int i; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS101/hs101t003.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS101/hs101t003.java index 2d554fd73ec..f08d07f2c17 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS101/hs101t003.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS101/hs101t003.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 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 @@ -25,6 +25,7 @@ package nsk.jvmti.scenarios.hotswap.HS101; import java.io.PrintStream; +import jdk.test.lib.thread.ThreadWrapper; import nsk.share.*; import nsk.share.jvmti.*; @@ -115,7 +116,7 @@ public class hs101t003 extends DebugeeClass { /* =================================================================== */ -class hs101t003Thread extends Thread { +class hs101t003Thread extends ThreadWrapper { public Wicket startingBarrier = new Wicket(); private volatile boolean flag = true; public int i; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS101/hs101t004.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS101/hs101t004.java index f43609ab042..121cb4a0aac 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS101/hs101t004.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS101/hs101t004.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 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 @@ -25,6 +25,7 @@ package nsk.jvmti.scenarios.hotswap.HS101; import java.io.PrintStream; +import jdk.test.lib.thread.ThreadWrapper; import nsk.share.*; import nsk.share.jvmti.*; @@ -98,7 +99,7 @@ public class hs101t004 extends DebugeeClass { /* =================================================================== */ -class hs101t004Thread extends Thread { +class hs101t004Thread extends ThreadWrapper { public Wicket startingBarrier = new Wicket(); private volatile boolean flag = true; public int i; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS101/hs101t005.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS101/hs101t005.java index afee53a2331..31bba4a409a 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS101/hs101t005.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS101/hs101t005.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 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 @@ -25,6 +25,7 @@ package nsk.jvmti.scenarios.hotswap.HS101; import java.io.PrintStream; +import jdk.test.lib.thread.ThreadWrapper; import nsk.share.*; import nsk.share.jvmti.*; @@ -98,7 +99,7 @@ public class hs101t005 extends DebugeeClass { /* =================================================================== */ -class hs101t005Thread extends Thread { +class hs101t005Thread extends ThreadWrapper { public Wicket startingBarrier = new Wicket(); private volatile boolean flag = true; public int i; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS101/hs101t006.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS101/hs101t006.java index 98568577032..a27521dcbd9 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS101/hs101t006.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS101/hs101t006.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 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 @@ -25,6 +25,7 @@ package nsk.jvmti.scenarios.hotswap.HS101; import java.io.PrintStream; +import jdk.test.lib.thread.ThreadWrapper; import nsk.share.*; import nsk.share.jvmti.*; @@ -98,7 +99,7 @@ public class hs101t006 extends DebugeeClass { /* =================================================================== */ -class hs101t006Thread extends Thread { +class hs101t006Thread extends ThreadWrapper { public Wicket startingBarrier = new Wicket(); private volatile boolean flag = true; public int i; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS101/hs101t007.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS101/hs101t007.java index f19805e9d1a..270fd7751a4 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS101/hs101t007.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS101/hs101t007.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 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 @@ -25,6 +25,7 @@ package nsk.jvmti.scenarios.hotswap.HS101; import java.io.PrintStream; +import jdk.test.lib.thread.ThreadWrapper; import nsk.share.*; import nsk.share.jvmti.*; @@ -95,7 +96,7 @@ public class hs101t007 extends DebugeeClass { /* =================================================================== */ -class hs101t007Thread extends Thread { +class hs101t007Thread extends ThreadWrapper { public Wicket startingBarrier = new Wicket(); private volatile boolean flag = true; public int i; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS101/hs101t008.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS101/hs101t008.java index b421cf3c185..9fca9678d0a 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS101/hs101t008.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS101/hs101t008.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 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 @@ -25,6 +25,7 @@ package nsk.jvmti.scenarios.hotswap.HS101; import java.io.PrintStream; +import jdk.test.lib.thread.ThreadWrapper; import nsk.share.*; import nsk.share.jvmti.*; @@ -95,7 +96,7 @@ public class hs101t008 extends DebugeeClass { /* =================================================================== */ -class hs101t008Thread extends Thread { +class hs101t008Thread extends ThreadWrapper { public Wicket startingBarrier = new Wicket(); private volatile boolean flag = true; public int i; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS102/hs102t001.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS102/hs102t001.java index 29d7aca6935..09ba44a5c32 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS102/hs102t001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS102/hs102t001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 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 @@ -25,6 +25,7 @@ package nsk.jvmti.scenarios.hotswap.HS102; import java.io.PrintStream; +import jdk.test.lib.thread.ThreadWrapper; import nsk.share.*; import nsk.share.jvmti.*; @@ -150,7 +151,7 @@ public class hs102t001 extends DebugeeClass { /* =================================================================== */ -class hs102t001Thread extends Thread { +class hs102t001Thread extends ThreadWrapper { public Wicket startingBarrier = new Wicket(); private volatile boolean flag = true; public int i; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS102/hs102t002.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS102/hs102t002.java index a34f3f6c109..c38fb07fb69 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS102/hs102t002.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS102/hs102t002.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 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 @@ -25,6 +25,7 @@ package nsk.jvmti.scenarios.hotswap.HS102; import java.io.PrintStream; +import jdk.test.lib.thread.ThreadWrapper; import nsk.share.*; import nsk.share.jvmti.*; @@ -150,7 +151,7 @@ public class hs102t002 extends DebugeeClass { /* =================================================================== */ -class hs102t002Thread extends Thread { +class hs102t002Thread extends ThreadWrapper { public Wicket startingBarrier = new Wicket(); private volatile boolean flag = true; public int i; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS103/hs103t002/MyThread.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS103/hs103t002/MyThread.java index 9f7d6e2f5c8..09fef278ca5 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS103/hs103t002/MyThread.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS103/hs103t002/MyThread.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 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 @@ -22,9 +22,11 @@ */ package nsk.jvmti.scenarios.hotswap.HS103.hs103t002; +import jdk.test.lib.thread.ThreadWrapper; + import java.util.concurrent.atomic.AtomicInteger; -public class MyThread extends Thread { +public class MyThread extends ThreadWrapper { public static AtomicInteger ai = new AtomicInteger(0); public static final int size = 10; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS103/hs103t002/newclass00/MyThread.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS103/hs103t002/newclass00/MyThread.java index 404ab78ff55..5874a1e11fc 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS103/hs103t002/newclass00/MyThread.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS103/hs103t002/newclass00/MyThread.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 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 @@ -22,9 +22,11 @@ */ package nsk.jvmti.scenarios.hotswap.HS103.hs103t002; +import jdk.test.lib.thread.ThreadWrapper; + import java.util.concurrent.atomic.AtomicInteger; -public class MyThread extends Thread { +public class MyThread extends ThreadWrapper { public static AtomicInteger ai = new AtomicInteger(0); public static final int size = 10; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS104/hs104t002/MyThread.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS104/hs104t002/MyThread.java index 771dfeeb054..2c5dfcf070c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS104/hs104t002/MyThread.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS104/hs104t002/MyThread.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 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 @@ -22,9 +22,10 @@ */ package nsk.jvmti.scenarios.hotswap.HS104.hs104t002; +import jdk.test.lib.thread.ThreadWrapper; import nsk.share.Wicket; -public class MyThread extends Thread { +public class MyThread extends ThreadWrapper { int threadState; private Wicket wicket; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS104/hs104t002/newclass00/MyThread.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS104/hs104t002/newclass00/MyThread.java index 6ebbc04b5c1..409a3f6ffcc 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS104/hs104t002/newclass00/MyThread.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS104/hs104t002/newclass00/MyThread.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 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 @@ -22,9 +22,10 @@ */ package nsk.jvmti.scenarios.hotswap.HS104.hs104t002; +import jdk.test.lib.thread.ThreadWrapper; import nsk.share.Wicket; -public class MyThread extends Thread { +public class MyThread extends ThreadWrapper { int threadState; private Wicket wicket; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t001.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t001.java index 2f6e2b15db7..2cb0f1bc683 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 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,7 @@ import java.io.PrintStream; import nsk.share.*; import nsk.share.jvmti.*; +import jdk.test.lib.thread.ThreadWrapper; public class hs201t001 extends DebugeeClass { @@ -74,7 +75,7 @@ public class hs201t001 extends DebugeeClass { timeout = argHandler.getWaitTime() * 60 * 1000; // milliseconds log.display(">>> starting tested thread"); - Thread thread = new hs201t001Thread(); + Thread thread = new hs201t001Thread().getThread(); // testing sync status = checkStatus(status); @@ -130,7 +131,7 @@ public class hs201t001 extends DebugeeClass { return status; } -class hs201t001Thread extends Thread { +class hs201t001Thread extends ThreadWrapper { hs201t001Thread() { setName("hs201t001Thread"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t002.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t002.java index c76a9b005d1..69d243d49b1 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t002.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t002.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 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 @@ -28,6 +28,7 @@ import java.util.concurrent.CountDownLatch; import nsk.share.*; import nsk.share.jvmti.*; +import jdk.test.lib.thread.ThreadWrapper; public class hs201t002 extends DebugeeClass { @@ -74,7 +75,8 @@ public class hs201t002 extends DebugeeClass { timeout = argHandler.getWaitTime() * 60 * 1000; // milliseconds log.display(">>> starting tested thread"); - hs201t002Thread thread = new hs201t002Thread(); + hs201t002Thread wrappedThread = new hs201t002Thread(); + Thread thread = wrappedThread.getThread(); // testing sync status = checkStatus(status); @@ -84,12 +86,12 @@ public class hs201t002 extends DebugeeClass { // setThread(thread) enables JVMTI events, and that can only be done on a live thread, // so wait until the thread has started. try { - thread.ready.await(); + wrappedThread.ready.await(); } catch (InterruptedException e) { } setThread(thread); - thread.go.countDown(); + wrappedThread.go.countDown(); while (currentStep != 4) { try { @@ -148,7 +150,7 @@ public class hs201t002 extends DebugeeClass { return status; } -class hs201t002Thread extends Thread { +class hs201t002Thread extends ThreadWrapper { CountDownLatch ready = new CountDownLatch(1); CountDownLatch go = new CountDownLatch(1); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t003.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t003.java index f33afd148e8..fc0680f88eb 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t003.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t003.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 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 @@ -25,6 +25,8 @@ package nsk.jvmti.scenarios.hotswap.HS201; import java.io.*; import java.util.*; + +import jdk.test.lib.thread.ThreadWrapper; import nsk.share.*; import nsk.share.jvmti.*; @@ -187,7 +189,7 @@ public class hs201t003 extends DebugeeClass { /** * Class executing a class to be redefined. */ - class RedefClassWrapper extends Thread { + class RedefClassWrapper extends ThreadWrapper { boolean stopMe = false; RedefClassWrapper() { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS202/hs202t001/MyThread.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS202/hs202t001/MyThread.java index ecb702f1873..b94ed1f8faa 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS202/hs202t001/MyThread.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS202/hs202t001/MyThread.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 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 @@ -21,7 +21,10 @@ * questions. */ package nsk.jvmti.scenarios.hotswap.HS202.hs202t001; -public class MyThread extends Thread { + +import jdk.test.lib.thread.ThreadWrapper; + +public class MyThread extends ThreadWrapper { MyObject myObject; public MyThread(MyObject obj) { this.myObject = obj; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS202/hs202t001/hs202t001.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS202/hs202t001/hs202t001.java index c386a88dc12..788d4114498 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS202/hs202t001/hs202t001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS202/hs202t001/hs202t001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 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 @@ -80,8 +80,8 @@ public class hs202t001 extends RedefineAgent { add(myObject, 1); } myObject.stop(true); - if( popThreadFrame(mt)) {; - resumeThread(mt); + if( popThreadFrame(mt.getThread())) {; + resumeThread(mt.getThread()); } // Popoing will not be possible on .. mt.join(); state = myObject.getAge(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS202/hs202t001/newclass00/MyThread.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS202/hs202t001/newclass00/MyThread.java index 9fbccbbcfab..7fc9dcf161a 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS202/hs202t001/newclass00/MyThread.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS202/hs202t001/newclass00/MyThread.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 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 @@ -21,7 +21,10 @@ * questions. */ package nsk.jvmti.scenarios.hotswap.HS202.hs202t001; -public class MyThread extends Thread { + +import jdk.test.lib.thread.ThreadWrapper; + +public class MyThread extends ThreadWrapper { MyObject myObject; public MyThread(MyObject obj) { this.myObject = obj; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS202/hs202t002/MyThread.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS202/hs202t002/MyThread.java index 45ec4af6249..c5e8fd6eb46 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS202/hs202t002/MyThread.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS202/hs202t002/MyThread.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 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 @@ -21,7 +21,10 @@ * questions. */ package nsk.jvmti.scenarios.hotswap.HS202.hs202t002; -public class MyThread extends Thread { + +import jdk.test.lib.thread.ThreadWrapper; + +public class MyThread extends ThreadWrapper { private int val = 100; public void run() { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS202/hs202t002/hs202t002.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS202/hs202t002/hs202t002.java index e78702cc587..dd295195543 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS202/hs202t002/hs202t002.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS202/hs202t002/hs202t002.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 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 @@ -70,15 +70,15 @@ public class hs202t002 extends RedefineAgent { try { mt.start(); - while (!isThreadSuspended(mt)) { + while (!isThreadSuspended(mt.getThread())) { Thread.yield(); } - if (!popThreadFrame(mt)) { + if (!popThreadFrame(mt.getThread())) { throw new RuntimeException("error in popframe operation!"); } - if (!resumeThread(mt)) { + if (!resumeThread(mt.getThread())) { throw new RuntimeException("error in resuming thread!"); } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS202/hs202t002/newclass00/MyThread.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS202/hs202t002/newclass00/MyThread.java index 32a7a085a13..1af54872316 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS202/hs202t002/newclass00/MyThread.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS202/hs202t002/newclass00/MyThread.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 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 @@ -21,7 +21,10 @@ * questions. */ package nsk.jvmti.scenarios.hotswap.HS202.hs202t002; -public class MyThread extends Thread { + +import jdk.test.lib.thread.ThreadWrapper; + +public class MyThread extends ThreadWrapper { private int val = 100; public void run() { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t001/MyThread.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t001/MyThread.java index c5646af4024..109ea8ec918 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t001/MyThread.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t001/MyThread.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 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 @@ -21,8 +21,10 @@ * questions. */ package nsk.jvmti.scenarios.hotswap.HS203.hs203t001; +import jdk.test.lib.thread.ThreadWrapper; + import java.util.concurrent.atomic.AtomicBoolean; -public class MyThread extends Thread { +public class MyThread extends ThreadWrapper { public static AtomicBoolean resume = new AtomicBoolean(false); public int threadState=100; public MyThread() { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t001/hs203t001.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t001/hs203t001.java index abbe8221444..e42bede4e01 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t001/hs203t001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t001/hs203t001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 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 @@ -76,8 +76,8 @@ public class hs203t001 extends RedefineAgent { mt.start(); while(!MyThread.resume.get()); Thread.sleep(10000); - popThreadFrame(mt); - resumeThread(mt); + popThreadFrame(mt.getThread()); + resumeThread(mt.getThread()); mt.join(); log.println(" ..."+mt.threadState); } catch(Exception ie) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t001/newclass00/MyThread.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t001/newclass00/MyThread.java index 4ddbfc43c79..c5792c9789d 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t001/newclass00/MyThread.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t001/newclass00/MyThread.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 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 @@ -21,8 +21,10 @@ * questions. */ package nsk.jvmti.scenarios.hotswap.HS203.hs203t001; +import jdk.test.lib.thread.ThreadWrapper; + import java.util.concurrent.atomic.AtomicBoolean; -public class MyThread extends Thread { +public class MyThread extends ThreadWrapper { public static AtomicBoolean resume = new AtomicBoolean(false); public int threadState=10; public MyThread() { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t002/MyThread.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t002/MyThread.java index 94eee8ebe07..787da2529d6 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t002/MyThread.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t002/MyThread.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 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 @@ -21,8 +21,10 @@ * questions. */ package nsk.jvmti.scenarios.hotswap.HS203.hs203t002; +import jdk.test.lib.thread.ThreadWrapper; + import java.util.concurrent.atomic.AtomicBoolean; -public class MyThread extends Thread { +public class MyThread extends ThreadWrapper { public static AtomicBoolean resume = new AtomicBoolean(false); public static AtomicBoolean resume2 = new AtomicBoolean(false); public int threadState=100; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t002/hs203t002.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t002/hs203t002.java index d9dd4a88c80..f62bd49f674 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t002/hs203t002.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t002/hs203t002.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 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 @@ -77,14 +77,14 @@ public class hs203t002 extends RedefineAgent { while(!MyThread.resume.get()); MyThread.resume.set(false); Thread.sleep(10000); - popThreadFrame(mt); - resumeThread(mt); + popThreadFrame(mt.getThread()); + resumeThread(mt.getThread()); while(!MyThread.resume2.get()); Thread.sleep(10000); - suspendThread(mt); + suspendThread(mt.getThread()); //mt.suspend(); - popThreadFrame(mt); - resumeThread(mt); + popThreadFrame(mt.getThread()); + resumeThread(mt.getThread()); MyThread.resume.set(true); mt.join(); log.println(" ..."+mt.threadState); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t002/newclass00/MyThread.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t002/newclass00/MyThread.java index cce4bd7326e..185bb0bd5e1 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t002/newclass00/MyThread.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t002/newclass00/MyThread.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 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 @@ -21,8 +21,10 @@ * questions. */ package nsk.jvmti.scenarios.hotswap.HS203.hs203t002; +import jdk.test.lib.thread.ThreadWrapper; + import java.util.concurrent.atomic.AtomicBoolean; -public class MyThread extends Thread { +public class MyThread extends ThreadWrapper { public static AtomicBoolean resume = new AtomicBoolean(false); public static AtomicBoolean resume2 = new AtomicBoolean(false); public int threadState=100; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t003/MyThread.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t003/MyThread.java index dd07c191f38..7942e765299 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t003/MyThread.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t003/MyThread.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 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 @@ -22,9 +22,11 @@ */ package nsk.jvmti.scenarios.hotswap.HS203.hs203t003; +import jdk.test.lib.thread.ThreadWrapper; + import java.util.concurrent.atomic.AtomicBoolean; -public class MyThread extends Thread { +public class MyThread extends ThreadWrapper { public static AtomicBoolean resume = new AtomicBoolean(false); public int threadState=0; // field watch is added on. diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t003/hs203t003.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t003/hs203t003.java index 348dc8b5ee4..6c4a018e0b7 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t003/hs203t003.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t003/hs203t003.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 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 @@ -93,7 +93,7 @@ public class hs203t003 extends RedefineAgent { Thread.sleep(100); } // Wait for the thread to be suspended. - while (!isSuspended(mt)) { + while (!isSuspended(mt.getThread())) { if (!agentStatus()) { System.out.println("Failed to suspend thread"); return passed; @@ -101,12 +101,12 @@ public class hs203t003 extends RedefineAgent { Thread.sleep(100); } // Pop the frame. - if (!popThreadFrame(mt)) { + if (!popThreadFrame(mt.getThread())) { System.out.println("Failed to pop a frame = " + mt.threadState); } // Resume the thread. - if(!resumeThread(mt)) { + if(!resumeThread(mt.getThread())) { System.out.println("Failed to resume the thread = " + mt.threadState); } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t003/newclass00/MyThread.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t003/newclass00/MyThread.java index e60b3da5c4b..105f90e360c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t003/newclass00/MyThread.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t003/newclass00/MyThread.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 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 @@ -22,8 +22,10 @@ */ package nsk.jvmti.scenarios.hotswap.HS203.hs203t003; +import jdk.test.lib.thread.ThreadWrapper; + import java.util.concurrent.atomic.AtomicBoolean; -public class MyThread extends Thread { +public class MyThread extends ThreadWrapper { public static AtomicBoolean resume = new AtomicBoolean(false); public int threadState=100; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t004/MyThread.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t004/MyThread.java index 8cf6750917a..84eea67fe4a 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t004/MyThread.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t004/MyThread.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 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 @@ -22,7 +22,9 @@ */ package nsk.jvmti.scenarios.hotswap.HS203.hs203t004; -public class MyThread extends Thread { +import jdk.test.lib.thread.ThreadWrapper; + +public class MyThread extends ThreadWrapper { public static volatile boolean stop = true; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t004/hs203t004.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t004/hs203t004.java index f9f1aa8a270..c8b1f09bf1e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t004/hs203t004.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t004/hs203t004.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 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 @@ -82,11 +82,11 @@ public class hs203t004 extends RedefineAgent { Thread.yield(); } - suspendThread(myThread); + suspendThread(myThread.getThread()); - popThreadFrame(myThread); + popThreadFrame(myThread.getThread()); - resumeThread(myThread); + resumeThread(myThread.getThread()); MyThread.stop = false; myThread.join(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t004/newclass00/MyThread.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t004/newclass00/MyThread.java index 7276b8cc5fd..f63dcc4577e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t004/newclass00/MyThread.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t004/newclass00/MyThread.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 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 @@ -23,7 +23,9 @@ package nsk.jvmti.scenarios.hotswap.HS203.hs203t004; -public class MyThread extends Thread { +import jdk.test.lib.thread.ThreadWrapper; + +public class MyThread extends ThreadWrapper { public static volatile boolean stop = true; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t002/MyThread.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t002/MyThread.java index c502e124814..5a220345c2d 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t002/MyThread.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t002/MyThread.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 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 @@ -21,7 +21,10 @@ * questions. */ package nsk.jvmti.scenarios.hotswap.HS204.hs204t002; -public class MyThread extends Thread{ + +import jdk.test.lib.thread.ThreadWrapper; + +public class MyThread extends ThreadWrapper { public static int value=100; static { System.out.println(" ... Break Point here.."); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t002/newclass00/MyThread.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t002/newclass00/MyThread.java index 0556e5dd45e..2fb796f1f56 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t002/newclass00/MyThread.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t002/newclass00/MyThread.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 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 @@ -21,7 +21,10 @@ * questions. */ package nsk.jvmti.scenarios.hotswap.HS204.hs204t002; -public class MyThread extends Thread{ + +import jdk.test.lib.thread.ThreadWrapper; + +public class MyThread extends ThreadWrapper { public static int value=200; static { System.out.println(" ... Break Point here.."); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t003/MyThread.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t003/MyThread.java index 7e9ba68c85d..51f8af20995 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t003/MyThread.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t003/MyThread.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 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 @@ -22,7 +22,9 @@ */ package nsk.jvmti.scenarios.hotswap.HS204.hs204t003; -public class MyThread extends Thread { +import jdk.test.lib.thread.ThreadWrapper; + +public class MyThread extends ThreadWrapper { private static volatile int intState=100; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t003/hs204t003.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t003/hs204t003.java index b0f716794dc..6607f76899c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t003/hs204t003.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t003/hs204t003.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 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 @@ -61,6 +61,7 @@ package nsk.jvmti.scenarios.hotswap.HS204.hs204t003; import nsk.share.jvmti.RedefineAgent; +import jdk.test.lib.thread.ThreadWrapper; public class hs204t003 extends RedefineAgent { public native boolean popFrame(Thread thread) ; @@ -82,7 +83,7 @@ public class hs204t003 extends RedefineAgent { TempThread temp = new TempThread(); temp.start(); Thread.sleep(10000); - popFrame(temp); + popFrame(temp.getThread()); temp.join(); mthread = temp.mthread; mthread.start(); @@ -104,7 +105,7 @@ public class hs204t003 extends RedefineAgent { return passed; } } -class TempThread extends Thread { +class TempThread extends ThreadWrapper { public MyThread mthread; public TempThread() { super("TempThread."); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t003/newclass00/MyThread.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t003/newclass00/MyThread.java index be2bc229538..b685015a2e3 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t003/newclass00/MyThread.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t003/newclass00/MyThread.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 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 @@ -21,7 +21,10 @@ * questions. */ package nsk.jvmti.scenarios.hotswap.HS204.hs204t003; -public class MyThread extends Thread { + +import jdk.test.lib.thread.ThreadWrapper; + +public class MyThread extends ThreadWrapper { private static volatile int intState=0; public static int count=100; static { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t004/hs204t004.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t004/hs204t004.java index e06eceeb425..08cd7d22d56 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t004/hs204t004.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t004/hs204t004.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 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 @@ -51,6 +51,8 @@ package nsk.jvmti.scenarios.hotswap.HS204.hs204t004; import java.util.concurrent.atomic.AtomicBoolean; + +import jdk.test.lib.thread.ThreadWrapper; import nsk.share.jvmti.RedefineAgent; public class hs204t004 extends RedefineAgent { @@ -71,7 +73,7 @@ public class hs204t004 extends RedefineAgent { mt.start(); while(!MyThread.resume.get()) ; Thread.sleep(10000); - popFrame(mt); + popFrame(mt.getThread()); mt.join(); } catch(Exception exp) { exp.printStackTrace(); @@ -88,7 +90,7 @@ public class hs204t004 extends RedefineAgent { public static native boolean popFrame(Thread thread); } -class MyThread extends Thread { +class MyThread extends ThreadWrapper { public static AtomicBoolean resume = new AtomicBoolean(false); public String name="MyThread"; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA03/ma03t001.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA03/ma03t001.java index 87751c5960f..7aab6551203 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA03/ma03t001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA03/ma03t001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 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,7 @@ import java.io.PrintStream; import nsk.share.*; import nsk.share.jvmti.*; +import jdk.test.lib.thread.ThreadWrapper; public class ma03t001 extends DebugeeClass { @@ -79,7 +80,7 @@ public class ma03t001 extends DebugeeClass { /* =================================================================== */ -class ma03t001Thread extends Thread { +class ma03t001Thread extends ThreadWrapper { public Wicket startingBarrier = new Wicket(); public Wicket endingBarrier = new Wicket(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP01/sp01t001.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP01/sp01t001.java index 7686e68952e..4c9d9bc65a4 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP01/sp01t001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP01/sp01t001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 @@ -28,6 +28,8 @@ import java.io.PrintStream; import nsk.share.*; import nsk.share.jvmti.*; +import jdk.test.lib.thread.ThreadWrapper; + public class sp01t001 extends DebugeeClass { // run test from command line @@ -51,7 +53,8 @@ public class sp01t001 extends DebugeeClass { int status = Consts.TEST_PASSED; // tested threads list - static sp01t001Thread threads[] = null; + static sp01t001Thread threadWrappers[] = null; + static Thread threads[] = null; static int indexStartedThread = 0; // run debuggee class @@ -60,21 +63,25 @@ public class sp01t001 extends DebugeeClass { log = new Log(out, argHandler); // create threads list - threads = new sp01t001Thread[] { + threadWrappers = new sp01t001Thread[] { // not started thread new sp01t001ThreadNotStarted(), // started threads new sp01t001ThreadFinished() }; + threads = new Thread[] { + threadWrappers[0].getThread(), + threadWrappers[1].getThread() + }; indexStartedThread = 1; // run threads try { // start threads for (int i = indexStartedThread; i < threads.length; i++) { - synchronized (threads[i].startingMonitor) { + synchronized (threadWrappers[i].startingMonitor) { threads[i].start(); - threads[i].startingMonitor.wait(); + threadWrappers[i].startingMonitor.wait(); } } @@ -98,7 +105,7 @@ public class sp01t001 extends DebugeeClass { /* =================================================================== */ // basic class for tested threads -abstract class sp01t001Thread extends Thread { +abstract class sp01t001Thread extends ThreadWrapper { public Object startingMonitor = new Object(); } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP01/sp01t001/sp01t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP01/sp01t001/sp01t001.cpp index 40db16504b6..93a4e05b135 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP01/sp01t001/sp01t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP01/sp01t001/sp01t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 @@ -34,7 +34,7 @@ extern "C" { /* constant names */ #define DEBUGEE_CLASS_NAME "nsk/jvmti/scenarios/sampling/SP01/sp01t001" -#define THREAD_CLASS_NAME "nsk/jvmti/scenarios/sampling/SP01/sp01t001Thread" +#define THREAD_CLASS_NAME "java/lang/Thread" #define THREADS_FIELD_NAME "threads" #define THREADS_FIELD_SIG "[L" THREAD_CLASS_NAME ";" diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/ExtraClassesBuilder.java b/test/hotspot/jtreg/vmTestbase/nsk/share/ExtraClassesBuilder.java index 162f8fa84c6..d92b1ef6b15 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/ExtraClassesBuilder.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/ExtraClassesBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 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 @@ -63,6 +63,8 @@ public class ExtraClassesBuilder { JDKToolLauncher javac = JDKToolLauncher.create("javac") .addToolArg("-d") .addToolArg(dst.toString()) + .addToolArg("-sourcepath") + .addToolArg(Utils.TEST_SRC_PATH) .addToolArg("-cp") .addToolArg(Utils.TEST_CLASS_PATH); diff --git a/test/lib/jdk/test/lib/Utils.java b/test/lib/jdk/test/lib/Utils.java index 2f46ed87340..95b7a117b2c 100644 --- a/test/lib/jdk/test/lib/Utils.java +++ b/test/lib/jdk/test/lib/Utils.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2025, 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 @@ -105,6 +105,11 @@ public final class Utils { */ public static final String TEST_SRC = System.getProperty("test.src", "").trim(); + /** + * Returns the value of 'test.src.path' system property. + */ + public static final String TEST_SRC_PATH = System.getProperty("test.src.path", "").trim(); + /** * Returns the value of 'test.root' system property. */ diff --git a/test/lib/jdk/test/lib/thread/ThreadWrapper.java b/test/lib/jdk/test/lib/thread/ThreadWrapper.java new file mode 100644 index 00000000000..ab850bf5a4a --- /dev/null +++ b/test/lib/jdk/test/lib/thread/ThreadWrapper.java @@ -0,0 +1,246 @@ +/* + * Copyright (c) 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +package jdk.test.lib.thread; + +import java.time.Duration; +import java.util.Map; + +/* + The ThreadWrapper is a helper class that allows to extend + coverage of virtual threads testing for existing tests with threads. + + Specifically, it is useful for the pattern where Thread is extended + by some class. Example: + + class resumethrd02Thread extends Thread {...} + ... + resumethrd02Thread thr = new resumethrd02Thread(); + + The test can be updated to use this wrapper: + class resumethrd02Thread extends ThreadWrapper {...} + ... + resumethrd02Thread thr = new resumethrd02Thread(); + + So resumethrd02Thread can be run with platform or virtual threads. + + Method getThread() is used to get instance of Thread. + + It is not expected to use this wrapper for new tests or classes that + are not extending Thread. The TestThreadFactory should be used to + create threads in such cases. + */ + +public class ThreadWrapper implements Runnable { + private final Thread thread; + + @SuppressWarnings("this-escape") + public ThreadWrapper() { + // thread is a platform or virtual thread + thread = TestThreadFactory.newThread(this); + } + + @SuppressWarnings("this-escape") + public ThreadWrapper(String name) { + // thread is a platform or virtual thread + thread = TestThreadFactory.newThread(this, name); + } + + public Thread getThread() { + return thread; + } + + public static Thread currentThread() { + return Thread.currentThread(); + } + + public static void yield() { + Thread.yield(); + } + + public static void sleep(long millis) throws InterruptedException { + Thread.sleep(millis); + } + + public static void sleep(long millis, int nanos) throws InterruptedException { + Thread.sleep(millis, nanos); + } + + public static void sleep(Duration duration) throws InterruptedException { + Thread.sleep(duration); + } + + public static void onSpinWait() { + Thread.onSpinWait(); + } + + public static Thread.Builder.OfPlatform ofPlatform() { + return Thread.ofPlatform(); + } + + public static Thread.Builder.OfVirtual ofVirtual() { + return Thread.ofVirtual(); + } + + public static Thread startVirtualThread(Runnable task) { + return Thread.startVirtualThread(task); + } + + public boolean isVirtual() { + return thread.isVirtual(); + } + + public void start() { + thread.start(); + } + + public void run() { + } + + public void interrupt() { + thread.interrupt(); + } + + public static boolean interrupted() { + return Thread.interrupted(); + } + + public boolean isInterrupted() { + return thread.isInterrupted(); + } + + public boolean isAlive() { + return thread.isAlive(); + } + + public void setPriority(int newPriority) { + thread.setPriority(newPriority); + } + + public int getPriority() { + return thread.getPriority(); + } + + public void setName(String name) { + thread.setName(name); + } + + public String getName() { + return thread.getName(); + } + + public ThreadGroup getThreadGroup() { + return thread.getThreadGroup(); + } + + public static int activeCount() { + return Thread.activeCount(); + } + + public static int enumerate(Thread[] tarray) { + return Thread.enumerate(tarray); + } + + public void join(long millis) throws InterruptedException { + thread.join(millis); + } + + public void join(long millis, int nanos) throws InterruptedException { + thread.join(millis, nanos); + } + + public void join() throws InterruptedException { + thread.join(); + } + + public boolean join(Duration duration) throws InterruptedException { + return thread.join(duration); + } + + public static void dumpStack() { + Thread.dumpStack(); + } + + public void setDaemon(boolean on) { + thread.setDaemon(on); + } + + public boolean isDaemon() { + return thread.isDaemon(); + } + + @Override + public String toString() { + return thread.toString(); + } + + public ClassLoader getContextClassLoader() { + return thread.getContextClassLoader(); + } + + public void setContextClassLoader(ClassLoader cl) { + thread.setContextClassLoader(cl); + } + + public static boolean holdsLock(Object obj) { + return Thread.holdsLock(obj); + } + + public StackTraceElement[] getStackTrace() { + return thread.getStackTrace(); + } + + public static Map getAllStackTraces() { + return Thread.getAllStackTraces(); + } + + @Deprecated(since = "19") + public long getId() { + return thread.getId(); + } + + public long threadId() { + return thread.threadId(); + } + + public Thread.State getState() { + return thread.getState(); + } + + public static void setDefaultUncaughtExceptionHandler(Thread.UncaughtExceptionHandler ueh) { + Thread.setDefaultUncaughtExceptionHandler(ueh); + } + + public static Thread.UncaughtExceptionHandler getDefaultUncaughtExceptionHandler() { + return Thread.getDefaultUncaughtExceptionHandler(); + } + + public Thread.UncaughtExceptionHandler getUncaughtExceptionHandler() { + return thread.getUncaughtExceptionHandler(); + } + + public void setUncaughtExceptionHandler(Thread.UncaughtExceptionHandler ueh) { + thread.setUncaughtExceptionHandler(ueh); + } +}