diff --git a/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/GarbageGenerator.java b/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/GarbageGenerator.java index bb9c9afa394b2..bc3ada61136a9 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/GarbageGenerator.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/GarbageGenerator.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 @@ -22,8 +22,9 @@ */ package nsk.stress.jni; +import jdk.test.lib.thread.ThreadWrapper; -class GarbageGenerator extends Thread { +class GarbageGenerator extends ThreadWrapper { class Garbage { Garbage() { this(1024); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/jnistress001.java b/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/jnistress001.java index 0335942e77555..16ccaa310a72d 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/jnistress001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/jnistress001.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,8 +61,9 @@ import nsk.share.Consts; import nsk.share.Debug; import nsk.share.test.StressOptions; +import jdk.test.lib.thread.ThreadWrapper; -public class jnistress001 extends Thread { +public class jnistress001 extends ThreadWrapper { /* Maximum number of iterations. Ignored if <= 0L */ static long numIteration = 0L; @@ -256,8 +257,11 @@ public static void main(String[] argv) { garb = new GarbageGenerator[nGarb]; for (i = 0; i < nJNI; i++) jniter[i] = new JNIter001(sync); + Thread[] jniterThreads = new Thread[nJNI]; + for (i = 0; i < nJNI; i++) + jniterThreads[i] = jniter[i].getThread(); for (i = 0; i < nInter; i++) { - irupt[i] = new Interrupter(jniter, sync); + irupt[i] = new Interrupter(jniterThreads, sync); irupt[i].setInterval(iruptInterval); } for (i = 0; i < nGarb; i++) { @@ -372,7 +376,7 @@ public boolean finished() { final private static boolean DEBUG = false; } -class JNIter001 extends Thread { +class JNIter001 extends ThreadWrapper { // The native method for testing JNI UTF-8 calls public native String jnistress(String threadName, int nstr, int printPeriod); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/jnistress002.java b/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/jnistress002.java index 1a9e2999f2042..5b6912b623d89 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/jnistress002.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/jnistress002.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 @@ -60,12 +60,13 @@ import nsk.share.Consts; import nsk.share.Debug; import nsk.share.test.StressOptions; +import jdk.test.lib.thread.ThreadWrapper; import jdk.test.lib.Utils; import java.lang.reflect.Field; import java.util.Random; -public class jnistress002 extends Thread { +public class jnistress002 extends ThreadWrapper { /* Maximum number of iterations. Ignored if <= 0L */ static long numIteration = 0L; @@ -246,8 +247,11 @@ public static void main(String[] argv) { garb = new GarbageGenerator[nGarb]; for (i = 0; i < nJNI; i++) jniter[i] = new JNIter002(sync); + Thread[] jniterThreads = new Thread[nJNI]; + for (i = 0; i < nJNI; i++) + jniterThreads[i] = jniter[i].getThread(); for (i = 0; i < nInter; i++) { - irupt[i] = new Interrupter(jniter, sync); + irupt[i] = new Interrupter(jniterThreads, sync); irupt[i].setInterval(iruptInterval); } for (i = 0; i < nGarb; i++) { @@ -423,7 +427,7 @@ public boolean equals(Object o) { } } -class JNIter002 extends Thread { +class JNIter002 extends ThreadWrapper { // The native method for testing JNI Object's calls public native objectsJNI[] jniobjects(String s, int i, long l, diff --git a/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/jnistress003.java b/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/jnistress003.java index e06f2e6279fed..b1e2702011a3c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/jnistress003.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/jnistress003.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 @@ -60,10 +60,11 @@ import nsk.share.Consts; import nsk.share.Debug; import nsk.share.test.StressOptions; +import jdk.test.lib.thread.ThreadWrapper; import java.lang.reflect.Array; -public class jnistress003 extends Thread { +public class jnistress003 extends ThreadWrapper { /* Maximum number of iterations. Ignored if <= 0L */ static long numIteration = 0L; @@ -257,8 +258,11 @@ public static void main(String[] argv) { garb = new GarbageGenerator[nGarb]; for (i = 0; i < nJNI; i++) jniter[i] = new JNIter003(sync); + Thread[] jniterThreads = new Thread[nJNI]; + for (i = 0; i < nJNI; i++) + jniterThreads[i] = jniter[i].getThread(); for (i = 0; i < nInter; i++) { - irupt[i] = new Interrupter(jniter, sync); + irupt[i] = new Interrupter(jniterThreads, sync); irupt[i].setInterval(iruptInterval); } for (i = 0; i < nGarb; i++) { @@ -379,7 +383,7 @@ public boolean finished() { final private static boolean DEBUG = false; } -class JNIter003 extends Thread { +class JNIter003 extends ThreadWrapper { // The native methods for testing JNI Arrays calls diff --git a/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/jnistress004.java b/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/jnistress004.java index 6432b0ccc3c19..705ddd8a5f1e0 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/jnistress004.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/jnistress004.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 @@ -60,8 +60,9 @@ import nsk.share.Consts; import nsk.share.Debug; import nsk.share.test.StressOptions; +import jdk.test.lib.thread.ThreadWrapper; -public class jnistress004 extends Thread { +public class jnistress004 extends ThreadWrapper { /* Maximum number of iterations. Ignored if <= 0L */ static long numIteration = 2L; @@ -243,8 +244,11 @@ public static void main(String[] argv) { garb = new GarbageGenerator[nGarb]; for (i = 0; i < nJNI; i++) jniter[i] = new JNIter004(sync); + Thread[] jniterThreads = new Thread[nJNI]; + for (i = 0; i < nJNI; i++) + jniterThreads[i] = jniter[i].getThread(); for (i = 0; i < nInter; i++) { - irupt[i] = new Interrupter(jniter, sync); + irupt[i] = new Interrupter(jniterThreads, sync); irupt[i].setInterval(iruptInterval); } for (i = 0; i < nGarb; i++) { @@ -364,7 +368,7 @@ public boolean finished() { final private static boolean DEBUG = false; } -class JNIter004 extends Thread { +class JNIter004 extends ThreadWrapper { // The native methods for testing JNI critical calls public native char[] CheckSum(String str); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/jnistress005.java b/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/jnistress005.java index a841635462b0b..0144c116f1eb0 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/jnistress005.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/jnistress005.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,8 +61,9 @@ import nsk.share.Consts; import nsk.share.Debug; import nsk.share.test.StressOptions; +import jdk.test.lib.thread.ThreadWrapper; -public class jnistress005 extends Thread { +public class jnistress005 extends ThreadWrapper { /* Maximum number of iterations. Ignored if <= 0L */ static long numIteration = 0L; @@ -244,8 +245,11 @@ public static void main(String[] argv) { garb = new GarbageGenerator[nGarb]; for (i = 0; i < nJNI; i++) jniter[i] = new JNIter005(sync); + Thread[] jniterThreads = new Thread[nJNI]; + for (i = 0; i < nJNI; i++) + jniterThreads[i] = jniter[i].getThread(); for (i = 0; i < nInter; i++) { - irupt[i] = new Interrupter(jniter, sync); + irupt[i] = new Interrupter(jniterThreads, sync); irupt[i].setInterval(iruptInterval); } for (i = 0; i < nGarb; i++) { @@ -366,7 +370,7 @@ public boolean finished() { final private static boolean DEBUG = false; } -class JNIter005 extends Thread { +class JNIter005 extends ThreadWrapper { // The native methods for testing JNI exception calls public native void except(Throwable tobj); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/jnistress006.java b/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/jnistress006.java index b6646bb45d412..80178bdef28be 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/jnistress006.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/jnistress006.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,8 +61,9 @@ import nsk.share.Consts; import nsk.share.Debug; import nsk.share.test.StressOptions; +import jdk.test.lib.thread.ThreadWrapper; -public class jnistress006 extends Thread { +public class jnistress006 extends ThreadWrapper { /* Maximum number of iterations. Ignored if <= 0L */ static long numIteration = 0L; @@ -245,8 +246,11 @@ public static void main(String[] argv) { garb = new GarbageGenerator[nGarb]; for (i = 0; i < nJNI; i++) jniter[i] = new JNIter006(sync); + Thread[] jniterThreads = new Thread[nJNI]; + for (i = 0; i < nJNI; i++) + jniterThreads[i] = jniter[i].getThread(); for (i = 0; i < nInter; i++) { - irupt[i] = new Interrupter(jniter, sync); + irupt[i] = new Interrupter(jniterThreads, sync); irupt[i].setInterval(iruptInterval); } for (i = 0; i < nGarb; i++) { @@ -366,7 +370,7 @@ public boolean finished() { final private static boolean DEBUG = false; } -class JNIter006 extends Thread { +class JNIter006 extends ThreadWrapper { // The native methods for testing JNI exception calls public native boolean refs(Object tobj, int jniStringAllocSize); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/jnistress007.java b/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/jnistress007.java index 7497660c9e0b9..727560fae3020 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/jnistress007.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/jnistress007.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,8 +61,9 @@ import nsk.share.Consts; import nsk.share.Debug; import nsk.share.test.StressOptions; +import jdk.test.lib.thread.ThreadWrapper; -public class jnistress007 extends Thread { +public class jnistress007 extends ThreadWrapper { /* Maximum number of iterations. Ignored if <= 0L */ static long numIteration = 0L; @@ -244,8 +245,11 @@ public static void main(String[] argv) { garb = new GarbageGenerator[nGarb]; for (i = 0; i < nJNI; i++) jniter[i] = new JNIter007(sync); + Thread[] jniterThreads = new Thread[nJNI]; + for (i = 0; i < nJNI; i++) + jniterThreads[i] = jniter[i].getThread(); for (i = 0; i < nInter; i++) { - irupt[i] = new Interrupter(jniter, sync); + irupt[i] = new Interrupter(jniterThreads, sync); irupt[i].setInterval(iruptInterval); } for (i = 0; i < nGarb; i++) { @@ -364,7 +368,7 @@ public boolean finished() { final private static boolean DEBUG = false; } -class JNIter007 extends Thread { +class JNIter007 extends ThreadWrapper { // The native methods for testing JNI monitors calls public native void incCount(String name);