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

now can sandbox on JVMs that do not support ThreadMXBean #84

Conversation

amoravec
Copy link
Contributor

@amoravec amoravec commented Apr 9, 2019

#83

@amoravec
Copy link
Contributor Author

amoravec commented Apr 9, 2019

In some cases JVMs may not support thead allocated memory measurement.
https://zgrepcode.com/java/openjdk/9/java.management/sun/management/threadimpl.java#L-116

This check is performed when calling ManagementFactory.getThreadMXBean().

It was throwing an UnsupportedOperationException in the constructor for the ThreadMonitor.

If the user does not configure a max cpu time or max memory usage, this fact can be ignored.

However if the user sets either a CPU limit or memory limit, then this exception is valid and must not be caught and swallowed.


private final com.sun.management.ThreadMXBean memoryCouter;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed typo memoryCouter -> memoryCounter

@mxro
Copy link
Collaborator

mxro commented Apr 12, 2019

That looks very useful, thank you!

Going to package up a new version with this change.

@mxro mxro merged commit e6590a7 into javadelight:master Apr 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants