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

Guard against InaccessibleObjectException in ExecutorServiceMetrics #2452

Merged
merged 1 commit into from Feb 17, 2021

Conversation

shakuzen
Copy link
Member

This is an issue with our current implementation for getting at the wrapped ThreadPoolExecutor in some types returned by Executors, when --illegal-access=deny is set. This is the default from Java 16. Without these changes, an uncaught exception is thrown when trying to perform the reflective access on binding ExecutorServiceMetrics with one of the private type ExecutorService in Executors.

With these changes, the exception will be caught and logged. We end up catching all RuntimeExceptions since we cannot use the InaccessibleObjectException type introduced in Java 9, but this is probably fine in this implementation anyways.

Resolves gh-2447

This is an issue with our current implementation for getting at the wrapped ThreadPoolExecutor in some types returned by Executors, when --illegal-access=deny is set. This is the default from Java 16. Without these changes, an uncaught exception is thrown when trying to perform the reflective access on binding ExecutorServiceMetrics with one of the private type ExecutorService in Executors.

With these changes, the exception will be caught and logged. We end up catching all RuntimeExceptions since we cannot use the InaccessibleObjectException type introduced in Java 9, but this is probably fine in this implementation anyways.

Resolves micrometer-metricsgh-2447
@shakuzen shakuzen merged commit 7f9b04b into micrometer-metrics:1.3.x Feb 17, 2021
@shakuzen shakuzen deleted the denied branch February 17, 2021 01:59
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

1 participant