Skip to content

Commit

Permalink
8267796: vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t002/TestD…
Browse files Browse the repository at this point in the history
…escription.java fails with NoClassDefFoundError

Reviewed-by: kevinw, cjplummer
  • Loading branch information
Alex Menkov committed Mar 2, 2022
1 parent 12a822a commit f12200c
Show file tree
Hide file tree
Showing 4 changed files with 102 additions and 92 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2004, 2022, 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
Expand All @@ -24,6 +24,7 @@
package nsk.jvmti.scenarios.hotswap.HS201;

import java.io.PrintStream;
import java.util.concurrent.CountDownLatch;

import nsk.share.*;
import nsk.share.jvmti.*;
Expand Down Expand Up @@ -73,14 +74,23 @@ public int runIt(String args[], PrintStream out) {
timeout = argHandler.getWaitTime() * 60 * 1000; // milliseconds

log.display(">>> starting tested thread");
Thread thread = new hs201t002Thread();
hs201t002Thread thread = new hs201t002Thread();

// testing sync
status = checkStatus(status);

setThread(thread);
thread.start();

// 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();
} catch (InterruptedException e) {
}
setThread(thread);

thread.go.countDown();

while (currentStep != 4) {
try {
Thread.sleep(100);
Expand Down Expand Up @@ -114,6 +124,10 @@ public int runIt(String args[], PrintStream out) {
}

log.display("Thread suspended in a wrong moment. Retrying...");
for (int i = 0; i < stackTrace.length; i++) {
log.display("\t" + i + ". " + stackTrace[i]);
}
log.display("Retrying...");
resumeThread(thread);
suspendTry++;
// Test thread will be suspended at the top of the loop. Let it run for a while.
Expand All @@ -136,12 +150,20 @@ public int runIt(String args[], PrintStream out) {

class hs201t002Thread extends Thread {

CountDownLatch ready = new CountDownLatch(1);
CountDownLatch go = new CountDownLatch(1);

hs201t002Thread() {
setName("hs201t002Thread");
}

public void run() {
// run method
ready.countDown();
try {
go.await();
} catch (InterruptedException e) {
}
try {
throwException();
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2022, 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
Expand Down Expand Up @@ -71,7 +71,7 @@
* newclass
*
* @run main/othervm/native
* -agentlib:hs201t002=pathToNewByteCode=./bin,-waittime=5
* nsk.jvmti.scenarios.hotswap.HS201.hs201t002
* -agentlib:hs201t002=pathToNewByteCode=./bin,-waittime=5,-verbose
* nsk.jvmti.scenarios.hotswap.HS201.hs201t002 -verbose
*/

Loading

1 comment on commit f12200c

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.