Skip to content
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

system rules support ibm J9 #2709

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open

Conversation

yanhom1314
Copy link

@yanhom1314 yanhom1314 commented May 7, 2022

Now system metrics are obtained from com.sun.management.OperatingSystemMXBean for HotSpot JVM, but these are in com.ibm.lang.management.OperatingSystemMXBean for Ibm J9, so need to deduce the target source.

@CLAassistant
Copy link

CLAassistant commented May 7, 2022

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ yanhom1314
❌ yanhom


yanhom seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@sczyh30 sczyh30 added the kind/enhancement Category issues or prs related to enhancement. label May 10, 2022
try {
return method != null ? (long) method.invoke(targetObj) : -1;
} catch (Exception e) {
return -1;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we need print the exeception?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

try {
return method != null ? (double) method.invoke(targetObj) : Double.NaN;
} catch (Exception e) {
return Double.NaN;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we need print the exeception?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

OPERATING_SYSTEM_BEAN_CLASS.cast(OPERATING_SYSTEM_BEAN);
return OPERATING_SYSTEM_BEAN_CLASS.getDeclaredMethod(name);
} catch (Exception e) {
return null;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we need print the exeception?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done!

* com.sun for HotSpot
*/
private static final List<String> OPERATING_SYSTEM_BEAN_CLASS_NAMES = Arrays.asList(
"com.sun.management.OperatingSystemMXBean", "com.ibm.lang.management.OperatingSystemMXBean");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think write the target class here is not a good way to extends other JVM. cloud you provide a common way to introduce the OperationSystemMXBean?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The difference only in the bean class name, treat as a common constant, I think there is no need to design a very abstract

@yanhom1314
Copy link
Author

Can this PR be merged?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement Category issues or prs related to enhancement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants