8327793: Deprecate jstatd for removal

Reviewed-by: alanb, cjplummer
This commit is contained in:
Kevin Walls 2024-06-21 13:51:06 +00:00
parent dbf5a9a400
commit 9f8de221d7
3 changed files with 6 additions and 3 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -32,6 +32,7 @@
* @moduleGraph * @moduleGraph
* @since 9 * @since 9
*/ */
@Deprecated(since="24", forRemoval=true)
module jdk.jstatd { module jdk.jstatd {
requires java.rmi; requires java.rmi;
requires jdk.internal.jvmstat; requires jdk.internal.jvmstat;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004, 2022, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -80,6 +80,8 @@ public class Jstatd {
int rmiPort = 0; int rmiPort = 0;
int argc = 0; int argc = 0;
System.err.println("WARNING: jstatd is deprecated and will be removed in a future release.");
for ( ; (argc < args.length) && (args[argc].startsWith("-")); argc++) { for ( ; (argc < args.length) && (args[argc].startsWith("-")); argc++) {
String arg = args[argc]; String arg = args[argc];

View File

@ -356,7 +356,7 @@ public final class JstatdTest {
OutputAnalyzer output = jstatdThread.getOutput(); OutputAnalyzer output = jstatdThread.getOutput();
List<String> stdout = output.asLinesWithoutVMWarnings(); List<String> stdout = output.asLinesWithoutVMWarnings();
output.reportDiagnosticSummary(); output.reportDiagnosticSummary();
assertEquals(stdout.size(), 1, "Output should contain one line"); assertEquals(stdout.size(), 2, "Output should contain two lines"); // includes deprecation warning
assertTrue(stdout.get(0).startsWith("jstatd started"), "List should start with 'jstatd started'"); assertTrue(stdout.get(0).startsWith("jstatd started"), "List should start with 'jstatd started'");
assertNotEquals(output.getExitValue(), 0, assertNotEquals(output.getExitValue(), 0,
"jstatd process exited with unexpected exit code"); "jstatd process exited with unexpected exit code");