8333108: Update vmTestbase/nsk/share/DebugeeProcess.java to don't use finalization

Backport-of: b3e29db144
This commit is contained in:
Goetz Lindenmaier
2024-09-16 06:36:01 +00:00
committed by Vitaly Provodin
parent 3e23c41656
commit bc9f48a6e6
6 changed files with 21 additions and 26 deletions

View File

@@ -107,6 +107,11 @@ public class tc04x001 {
e.printStackTrace();
} finally {
debugee.resume();
int code = debugee.waitFor();
if (code != Consts.JCK_STATUS_BASE) {
log.complain("Debugee FAILED with exit code: " + code);
exitStatus = Consts.TEST_FAILED;
}
}
display("Test finished. exitStatus = " + exitStatus);

View File

@@ -278,7 +278,12 @@ public class vmdeath003 extends JDIBase {
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
}
log1(" TESTING ENDS");
return;
int code = debuggee.waitFor();
if (code != Consts.JCK_STATUS_BASE) {
log2("Debugee FAILED with exit code: " + code);
testExitCode = Consts.TEST_FAILED;
}
}
}

View File

@@ -171,6 +171,12 @@ public class exit001 {
logHandler.complain("TEST FAILED");
}
int code = debuggee.waitFor();
if (code != 0) {
log2("Debugee FAILED with exit code: " + code);
testExitCode = Consts.TEST_FAILED;
}
return testExitCode;
}
}

View File

@@ -128,8 +128,6 @@ public class Binder extends DebugeeBinder {
*/
public Debugee makeLocalDebugee(Process process) {
LocalLaunchedDebugee debugee = new LocalLaunchedDebugee(process, this);
debugee.registerCleanup();
return debugee;
}
@@ -939,9 +937,6 @@ public class Binder extends DebugeeBinder {
}
RemoteLaunchedDebugee debugee = new RemoteLaunchedDebugee(this);
debugee.registerCleanup();
return debugee;
}
@@ -952,9 +947,6 @@ public class Binder extends DebugeeBinder {
protected ManualLaunchedDebugee startManualDebugee(String cmd) {
ManualLaunchedDebugee debugee = new ManualLaunchedDebugee(this);
debugee.launchDebugee(cmd);
debugee.registerCleanup();
return debugee;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2024, 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
@@ -106,8 +106,6 @@ final public class Binder extends DebugeeBinder {
debugee.redirectOutput(log);
}
debugee.registerCleanup();
Transport transport = debugee.connect();
return debugee;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2024, 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
@@ -52,7 +52,7 @@ import java.util.function.Consumer;
* @see nsk.share.jdi.Debugee
* @see nsk.share.jdwp.Debugee
*/
abstract public class DebugeeProcess extends FinalizableObject {
abstract public class DebugeeProcess {
/** Default prefix for log messages. */
public static final String LOG_PREFIX = "binder> ";
@@ -84,9 +84,6 @@ abstract public class DebugeeProcess extends FinalizableObject {
protected DebugeeProcess (DebugeeBinder binder) {
this.binder = binder;
this.log = binder.getLog();
// Register the cleanup() method to be called when this instance becomes unreachable.
registerCleanup();
}
/**
@@ -430,7 +427,7 @@ abstract public class DebugeeProcess extends FinalizableObject {
/**
* Kill the debugee VM if it is not terminated yet.
*
* @throws Throwable if any throwable exception is thrown during finalization
* @throws Throwable if any throwable exception is thrown during shutdown
*/
public void close() {
if (checkTermination) {
@@ -458,12 +455,4 @@ abstract public class DebugeeProcess extends FinalizableObject {
log.complain(prefix + message);
}
/**
* Finalize debuggee VM wrapper by invoking <code>close()</code>.
*
* @throws Throwable if any throwable exception is thrown during finalization
*/
public void cleanup() {
close();
}
}