jmx-dev RFR: 8373441: Remove DCmdFactory::_enabled [v2]

Ioi Lam iklam at openjdk.org
Fri Dec 12 23:37:22 UTC 2025


On Fri, 12 Dec 2025 16:53:33 GMT, Kevin Walls <kevinw at openjdk.org> wrote:

> The Java API has "enabled" handled in src/jdk.management/share/classes/com/sun/management/internal/DiagnosticCommandInfo.java (and read in src/jdk.management/share/classes/com/sun/management/internal/DiagnosticCommandImpl.java)
> 
> In the public API docs we do specify a Descriptor for diagnostic commands:
> 
> https://docs.oracle.com/en/java/javase/25/docs/api/jdk.management/com/sun/management/DiagnosticCommandMBean.html dcmd.enabled boolean True if the diagnostic command is enabled, false otherwise
> 
> dcmd.enabled is already not very meaningful as it's always true, but if it becomes truly meaningless, it needs thought on whether it stays, maybe with a comment that it is always true, or can be removed.
> 
> The Java api deals with remote connections, so interactions between JDK versions need considering. If dcmd.enabled is not found, if a client app ever checks this Descriptor, does the app think it's not enabled?
> 
> Maybe it stays in the Descriptor for compatibility reasons, but can be removed from DiagnosticCommandInfo.
> 
> This could be a follow up issue if we aren't doing it now.

For compatibility reasons, I don't want to touch the Java APIs in this PR. I updated the comments in DiagnosticCommandMBean.java to say


 *     <th scope="row">dcmd.enabled</th><td>boolean</td>
 *     <td>This field is always true -- diagnostic commands cannot be disabled.</td>

-------------

PR Comment: https://git.openjdk.org/jdk/pull/28794#issuecomment-3648510642


More information about the jmx-dev mailing list