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

Reviewed-by: cjplummer, sspitsyn
This commit is contained in:
Leonid Mesnik 2024-05-30 18:21:40 +00:00
parent 11e926cf50
commit b3e29db144
6 changed files with 21 additions and 26 deletions

View File

@ -110,6 +110,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

@ -280,7 +280,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

@ -173,6 +173,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;
}
@ -936,9 +934,6 @@ public class Binder extends DebugeeBinder {
}
RemoteLaunchedDebugee debugee = new RemoteLaunchedDebugee(this);
debugee.registerCleanup();
return debugee;
}
@ -949,9 +944,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();
}
}