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

[4.x] - Remove non-virtual executor support #7324

Merged
merged 4 commits into from
Aug 18, 2023

Conversation

dalexandrov
Copy link
Contributor

Resolves #7272
Removes non-virtual executor support

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Aug 7, 2023
@dalexandrov dalexandrov self-assigned this Aug 7, 2023
@dalexandrov dalexandrov added the 4.x Version 4.x label Aug 7, 2023
Signed-off-by: Dmitry Aleksandrov <dmitry.aleksandrov@oracle.com>
@dalexandrov dalexandrov force-pushed the 7272_Remove_Virtual branch from 21a2b83 to 3e771c3 Compare August 8, 2023 09:40
Signed-off-by: Dmitry Aleksandrov <dmitry.aleksandrov@oracle.com>
@dalexandrov
Copy link
Contributor Author

After some investigations I found out that java.util.concurrent.ThreadPerTaskExecutor is package private, so it cannot be accessed without reflection.
So there are two options:

  • keep everything as is. Currently this infrastructure is done only for one metric threadCount which is got out of package private public long java.util.concurrent.ThreadPerTaskExecutor.threadCount(). This infrastructure allows accessing other potential "hidden" metrics, accessible via reflection.
  • remove entire method invocation infrastructure and not publish this metric. This is done in this PR.

@tomas-langer and @tjquinno, please share your thoughts.

Signed-off-by: Dmitry Aleksandrov <dmitry.aleksandrov@oracle.com>
@tjquinno
Copy link
Member

tjquinno commented Aug 9, 2023

Generally, I have mixed feelings about the value of keeping this feature. The argument can be made that, in 4.x, exposing this metric is less important than in earlier releases with Helidon's use of virtual threads.

TBH, I do not have very strong feelings either way about keeping the metric (and therefore having to continue using reflection which we like to avoid) vs. removing the metric. If there are effective actions an operations person can take after monitoring this metric, then that does argue for keeping it. If not, then not!

Comment on lines 97 to 99
if (executorService instanceof ThreadPoolExecutor) {
registerMetrics((ThreadPoolExecutor) executorService, index);
}
Copy link
Member

@tjquinno tjquinno Aug 9, 2023

Choose a reason for hiding this comment

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

If we are going to keep this feature (and the addition of the type checking before casting is good), then we might as well use instanceof pattern matching:

if (executorService instance ThreadPoolExecutor tpe) {
    registerMetrics(tpe, index);
}

I know it's a small stylistic point and functionally no different from doing explicit casting (ThreadPoolExecutor), but it is more concise and less prone to typos.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Applied! Thank you!

Signed-off-by: Dmitry Aleksandrov <dmitry.aleksandrov@oracle.com>
@dalexandrov dalexandrov marked this pull request as ready for review August 10, 2023 07:42
@dalexandrov dalexandrov requested a review from tjquinno August 10, 2023 09:42
@tjquinno
Copy link
Member

IF we want to keep this feature I'm OK with the changes in the PR.

The question is whether we want to keep the metric. As I said, I could be convinced either way.

@tomas-langer
Copy link
Member

@tjquinno please decide yourself, then either approve or request changes ;)
Thanks

@dalexandrov dalexandrov merged commit e102926 into helidon-io:main Aug 18, 2023
@dalexandrov dalexandrov deleted the 7272_Remove_Virtual branch August 18, 2023 11:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4.x Version 4.x OCA Verified All contributors have signed the Oracle Contributor Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants