Expose NIOThreadPool.numberOfThreads
publicly.
#2676
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation:
numberOfThreads
is a required parameter to the public constructor, it's therefore known to the caller. Any use case that wants to optimise its logic for the parallelism offered by the particularNIOThreadPool
needs to carry the number of threads separately from theNIOThreadPool
itself. We should exposesnumberOfThreads
publicly fromNIOThreadPool
to avoid this complexity and possible bugs.This is especially true for
NIOThreadPool.singleton
where the decision on the number of threads used is achieved through some complex and dynamic logic. It's therefore best not to second guess the result of those calculations.Modifications:
Flip the visibility of
numberOfThreads
inNIOThreadPool
topublic
.Result:
Some complexity gets removed from client packages.