Skip to content

Commit

Permalink
Add OpenJ9DiagnosticsMXBean.getDumpOptions
Browse files Browse the repository at this point in the history
There should be a getter to match the setter.

Issue eclipse-openj9#20587

Signed-off-by: Peter Shipton <[email protected]>
  • Loading branch information
pshipton committed Nov 19, 2024
1 parent 9464ff3 commit e85729a
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}
*/
Expand Down

0 comments on commit e85729a

Please sign in to comment.