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

Add checkstyle rule for use of default thread pool on completable futures. #7280

Open
tkaitchuck opened this issue Sep 22, 2023 · 0 comments · May be fixed by #7279
Open

Add checkstyle rule for use of default thread pool on completable futures. #7280

tkaitchuck opened this issue Sep 22, 2023 · 0 comments · May be fixed by #7279

Comments

@tkaitchuck
Copy link
Member

Describe the bug
CompletableFuture has several method such as thenRunAsync or thenComposeAsync which take a lambda and run it on a threadpool. These come in two variants: a single argument version which runs on the 'default' threadpool and one where a pool is provided.
In the context of Pravega we always use the supplied thread pool version so that we can control the pool the function is run on as well as have clearly named threads in stack traces and logs.
This means that leaving off the second parameter is almost certainly a mistake, but it one that is easy to make as the code compiles and easy to miss in code review because the name of the method is the same.
We should add a checkstyle rule to detect these sorts of accidents and correct the ones which exist in the code base.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant