-
Notifications
You must be signed in to change notification settings - Fork 737
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support HotSpotDiagnosticMXBean in OpenJ9 JDK21+ #17709
Merged
pshipton
merged 1 commit into
eclipse-openj9:master
from
babsingh:support_HotSpotDiagnosticMXBean
Jun 30, 2023
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
jcl/src/java.management/share/classes/sun/management/LazyCompositeData.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
jcl/src/java.management/share/classes/sun/management/LockInfoCompositeData.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
jcl/src/java.management/share/classes/sun/management/MappedMXBeanType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
jcl/src/java.management/share/classes/sun/management/MemoryNotifInfoCompositeData.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
jcl/src/java.management/share/classes/sun/management/MemoryUsageCompositeData.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
jcl/src/java.management/share/classes/sun/management/MonitorInfoCompositeData.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
jcl/src/java.management/share/classes/sun/management/StackTraceElementCompositeData.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
jcl/src/java.management/share/classes/sun/management/ThreadInfoCompositeData.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
jcl/src/jdk.management/share/classes/com/sun/management/HotSpotDiagnosticMXBean.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
jcl/src/jdk.management/share/classes/com/sun/management/VMOption.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
96 changes: 96 additions & 0 deletions
96
...c/jdk.management/share/classes/com/sun/management/internal/ExtendedHotSpotDiagnostic.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
/*[INCLUDE-IF JAVA_SPEC_VERSION >= 21]*/ | ||
/******************************************************************************* | ||
* Copyright IBM Corp. and others 2023 | ||
* | ||
* This program and the accompanying materials are made available under | ||
* the terms of the Eclipse Public License 2.0 which accompanies this | ||
* distribution and is available at https://www.eclipse.org/legal/epl-2.0/ | ||
* or the Apache License, Version 2.0 which accompanies this distribution and | ||
* is available at https://www.apache.org/licenses/LICENSE-2.0. | ||
* | ||
* This Source Code may also be made available under the following | ||
* Secondary Licenses when the conditions for such availability set | ||
* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU | ||
* General Public License, version 2 with the GNU Classpath | ||
* Exception [1] and GNU General Public License, version 2 with the | ||
* OpenJDK Assembly Exception [2]. | ||
* | ||
* [1] https://www.gnu.org/software/classpath/license.html | ||
* [2] https://openjdk.org/legal/assembly-exception.html | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 OR GPL-2.0-only WITH OpenJDK-assembly-exception-1.0 | ||
*******************************************************************************/ | ||
|
||
package com.sun.management.internal; | ||
|
||
import java.io.IOException; | ||
import java.util.List; | ||
import java.util.Collections; | ||
import com.sun.management.VMOption; | ||
import com.sun.management.HotSpotDiagnosticMXBean; | ||
import com.sun.management.internal.HotSpotDiagnostic; | ||
|
||
/** | ||
* Runtime type for {@link com.sun.management.HotSpotDiagnosticMXBean}. | ||
*/ | ||
public class ExtendedHotSpotDiagnostic extends HotSpotDiagnostic implements HotSpotDiagnosticMXBean { | ||
|
||
private static final HotSpotDiagnosticMXBean instance = new ExtendedHotSpotDiagnostic(); | ||
|
||
/** | ||
* Singleton accessor method. | ||
* | ||
* @return the <code>HotSpotDiagnostic</code> singleton. | ||
*/ | ||
public static HotSpotDiagnosticMXBean getInstance() { | ||
return instance; | ||
} | ||
|
||
/** | ||
* Constructor intentionally private to prevent instantiation by others. | ||
*/ | ||
private ExtendedHotSpotDiagnostic() { | ||
super(); | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
@Override | ||
public void dumpHeap(String outputFile, boolean live) throws IOException { | ||
throw new UnsupportedOperationException(); | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
@Override | ||
public List<VMOption> getDiagnosticOptions() { | ||
return Collections.emptyList(); | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
@Override | ||
public VMOption getVMOption(String name) { | ||
if (name == null) { | ||
throw new NullPointerException("A non-null name is required"); | ||
} | ||
throw new IllegalArgumentException("OpenJ9 doesn't support the API i.e. the VM option might exist, but OpenJ9 can't retrieve it"); | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
@Override | ||
public void setVMOption(String name, String value) { | ||
if (name == null) { | ||
throw new NullPointerException("A non-null name is required"); | ||
} | ||
if (value == null) { | ||
throw new NullPointerException("A non-null value is required"); | ||
} | ||
throw new IllegalArgumentException("OpenJ9 doesn't support the API i.e. the VM option might exist, but OpenJ9 can't set it"); | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
jcl/src/jdk.management/share/classes/com/sun/management/internal/Flag.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
jcl/src/jdk.management/share/classes/com/sun/management/internal/HotSpotDiagnostic.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
jcl/src/jdk.management/share/classes/com/sun/management/internal/VMOptionCompositeData.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please help me understand why this was removed. This code is specific to Java 8 where there's no possibility that
OpenJ9DiagnosticsMXBeanImpl.getInstance()
might returnnull
(even though the code would properly handle that situation). Why do we no longer want this bean to be registered?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah good catch, I missed it was specific to 8 (and we didn't test 8). So we need to add it back and add the HotspotBean there too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Opened #17726 to readd the registration calls.