diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/StopThread/stopthrd007.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/StopThread/stopthrd007.java index 61df040bcd4..fe4f346a213 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/StopThread/stopthrd007.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/StopThread/stopthrd007.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,8 @@ import java.io.PrintStream; import nsk.share.*; import nsk.share.jvmti.*; +import java.util.concurrent.locks.LockSupport; + public class stopthrd007 extends DebugeeClass { // run test from command line @@ -66,6 +68,11 @@ public class stopthrd007 extends DebugeeClass { log = new Log(out, argHandler); timeout = argHandler.getWaitTime() * 60 * 1000; + // Unpark virtual threads to load jdk.internal.misc.VirtualThreads + // and avoid NoClassDefFoundError if ThreadDeath is happen during unlock. + Thread vt = Thread.startVirtualThread(LockSupport::park); + LockSupport.unpark(vt); + log.display("Debugee started"); startingBarrier = new Wicket(3);