Skip to content

Commit b3e29db

Browse files
committed
8333108: Update vmTestbase/nsk/share/DebugeeProcess.java to don't use finalization
Reviewed-by: cjplummer, sspitsyn
1 parent 11e926c commit b3e29db

File tree

6 files changed

+21
-26
lines changed

6 files changed

+21
-26
lines changed

test/hotspot/jtreg/vmTestbase/nsk/jdi/BScenarios/multithrd/tc04x001.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,11 @@ public static int run(String argv[], PrintStream out) {
110110
e.printStackTrace();
111111
} finally {
112112
debugee.resume();
113+
int code = debugee.waitFor();
114+
if (code != Consts.JCK_STATUS_BASE) {
115+
log.complain("Debugee FAILED with exit code: " + code);
116+
exitStatus = Consts.TEST_FAILED;
117+
}
113118
}
114119
display("Test finished. exitStatus = " + exitStatus);
115120

test/hotspot/jtreg/vmTestbase/nsk/jdi/VMDeathEvent/_itself_/vmdeath003.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,12 @@ private void testRun()
280280
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
281281
}
282282
log1(" TESTING ENDS");
283-
return;
283+
int code = debuggee.waitFor();
284+
if (code != Consts.JCK_STATUS_BASE) {
285+
log2("Debugee FAILED with exit code: " + code);
286+
testExitCode = Consts.TEST_FAILED;
287+
}
288+
284289
}
285290

286291
}

test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/exit/exit001.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,12 @@ private int runThis(String argv[], PrintStream out) {
173173
logHandler.complain("TEST FAILED");
174174
}
175175

176+
int code = debuggee.waitFor();
177+
if (code != 0) {
178+
log2("Debugee FAILED with exit code: " + code);
179+
testExitCode = Consts.TEST_FAILED;
180+
}
181+
176182
return testExitCode;
177183
}
178184
}

test/hotspot/jtreg/vmTestbase/nsk/share/jdi/Binder.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,6 @@ public Binder (ArgumentHandler argumentHandler, Log log) {
128128
*/
129129
public Debugee makeLocalDebugee(Process process) {
130130
LocalLaunchedDebugee debugee = new LocalLaunchedDebugee(process, this);
131-
132-
debugee.registerCleanup();
133131
return debugee;
134132
}
135133

@@ -936,9 +934,6 @@ protected RemoteLaunchedDebugee startRemoteDebugee(String[] cmdArgs) {
936934
}
937935

938936
RemoteLaunchedDebugee debugee = new RemoteLaunchedDebugee(this);
939-
940-
debugee.registerCleanup();
941-
942937
return debugee;
943938
}
944939

@@ -949,9 +944,6 @@ protected RemoteLaunchedDebugee startRemoteDebugee(String[] cmdArgs) {
949944
protected ManualLaunchedDebugee startManualDebugee(String cmd) {
950945
ManualLaunchedDebugee debugee = new ManualLaunchedDebugee(this);
951946
debugee.launchDebugee(cmd);
952-
953-
debugee.registerCleanup();
954-
955947
return debugee;
956948
}
957949

test/hotspot/jtreg/vmTestbase/nsk/share/jdwp/Binder.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2001, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -106,8 +106,6 @@ public Debugee bindToDebugee (String classToExecute) {
106106
debugee.redirectOutput(log);
107107
}
108108

109-
debugee.registerCleanup();
110-
111109
Transport transport = debugee.connect();
112110

113111
return debugee;

test/hotspot/jtreg/vmTestbase/nsk/share/jpda/DebugeeProcess.java

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2001, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -52,7 +52,7 @@
5252
* @see nsk.share.jdi.Debugee
5353
* @see nsk.share.jdwp.Debugee
5454
*/
55-
abstract public class DebugeeProcess extends FinalizableObject {
55+
abstract public class DebugeeProcess {
5656

5757
/** Default prefix for log messages. */
5858
public static final String LOG_PREFIX = "binder> ";
@@ -84,9 +84,6 @@ abstract public class DebugeeProcess extends FinalizableObject {
8484
protected DebugeeProcess (DebugeeBinder binder) {
8585
this.binder = binder;
8686
this.log = binder.getLog();
87-
88-
// Register the cleanup() method to be called when this instance becomes unreachable.
89-
registerCleanup();
9087
}
9188

9289
/**
@@ -430,7 +427,7 @@ public JDWP.ListenAddress redirectOutputAndDetectListeningAddress(Log log) {
430427
/**
431428
* Kill the debugee VM if it is not terminated yet.
432429
*
433-
* @throws Throwable if any throwable exception is thrown during finalization
430+
* @throws Throwable if any throwable exception is thrown during shutdown
434431
*/
435432
public void close() {
436433
if (checkTermination) {
@@ -458,12 +455,4 @@ protected void complain(String message) {
458455
log.complain(prefix + message);
459456
}
460457

461-
/**
462-
* Finalize debuggee VM wrapper by invoking <code>close()</code>.
463-
*
464-
* @throws Throwable if any throwable exception is thrown during finalization
465-
*/
466-
public void cleanup() {
467-
close();
468-
}
469458
}

0 commit comments

Comments
 (0)