From e85729a2d5b377dcfa05f50cb87544e44d4addb1 Mon Sep 17 00:00:00 2001 From: Peter Shipton Date: Fri, 15 Nov 2024 10:38:55 -0500 Subject: [PATCH] Add OpenJ9DiagnosticsMXBean.getDumpOptions There should be a getter to match the setter. Issue https://github.com/eclipse-openj9/openj9/issues/20587 Signed-off-by: Peter Shipton --- .../lang/management/OpenJ9DiagnosticsMXBean.java | 14 +++++++++++++- .../internal/OpenJ9DiagnosticsMXBeanImpl.java | 16 ++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/jcl/src/jdk.management/share/classes/openj9/lang/management/OpenJ9DiagnosticsMXBean.java b/jcl/src/jdk.management/share/classes/openj9/lang/management/OpenJ9DiagnosticsMXBean.java index 4c7b1f73ed1..3ba34f38ff5 100644 --- a/jcl/src/jdk.management/share/classes/openj9/lang/management/OpenJ9DiagnosticsMXBean.java +++ b/jcl/src/jdk.management/share/classes/openj9/lang/management/OpenJ9DiagnosticsMXBean.java @@ -71,10 +71,22 @@ public interface OpenJ9DiagnosticsMXBean extends PlatformManagedObject { * with the initial -Xdump: omitted. See the -Xdump option section on dump agents in * the documentation for the OpenJ9 JVM. * + * @return the dump configuration as an array of Strings * @throws SecurityException if there is a security manager and it doesn't allow the checks required to read the dump settings */ public String[] queryDumpOptions(); + /** + * Returns the current dump configuration as a comma-separated String, or null if an internal error occurs. + * The syntax of the option String is the same as the -Xdump command-line option, + * with the initial -Xdump: omitted. See the -Xdump option section on dump agents in + * the documentation for the OpenJ9 JVM. + * + * @return the dump configuration as a comma-separated String + * @throws SecurityException if there is a security manager and it doesn't allow the checks required to read the dump settings + */ + public String getDumpOptions(); + /** * This function sets options for the dump subsystem. * The dump option is passed in as a String. Use the same syntax as the -Xdump command-line option, with the @@ -143,7 +155,7 @@ public interface OpenJ9DiagnosticsMXBean extends PlatformManagedObject { /** * This function triggers the heap dump agent and requests for a heap dump in CLASSIC format. * - * @return The file name of the dump that was created + * @return the file name of the dump that was created * @throws InvalidOptionException if the dump operation fails * @throws RuntimeException if the JVM does not contain RAS dump support * @throws SecurityException if there is a security manager and it doesn't allow the checks required to trigger this dump diff --git a/jcl/src/jdk.management/share/classes/openj9/lang/management/internal/OpenJ9DiagnosticsMXBeanImpl.java b/jcl/src/jdk.management/share/classes/openj9/lang/management/internal/OpenJ9DiagnosticsMXBeanImpl.java index 8adbd8b8f9d..694199489a3 100644 --- a/jcl/src/jdk.management/share/classes/openj9/lang/management/internal/OpenJ9DiagnosticsMXBeanImpl.java +++ b/jcl/src/jdk.management/share/classes/openj9/lang/management/internal/OpenJ9DiagnosticsMXBeanImpl.java @@ -131,6 +131,22 @@ public String[] queryDumpOptions() { } } + /** + * {@inheritDoc} + */ + @Override + public String getDumpOptions() { + String[] options = queryDumpOptions(); + StringBuilder builder = new StringBuilder(); + for (int i = 0; i < options.length; i++) { + if (i != 0) { + builder.append(','); + } + builder.append(options[i]); + } + return builder.toString(); + } + /** * {@inheritDoc} */