-
Notifications
You must be signed in to change notification settings - Fork 428
OAK-12054: Refactor creation of ThreadPoolExecutors #2679
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
base: trunk
Are you sure you want to change the base?
Conversation
.../src/main/java/org/apache/jackrabbit/oak/commons/internal/concurrent/NamedThreadFactory.java
Outdated
Show resolved
Hide resolved
oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/concurrent/NamedThreadFactory.java
Outdated
Show resolved
Hide resolved
oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/concurrent/ExecutorHelper.java
Outdated
Show resolved
Hide resolved
oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/concurrent/ExecutorHelper.java
Outdated
Show resolved
Hide resolved
oak-run-commons/src/main/java/org/apache/jackrabbit/oak/index/IndexHelper.java
Outdated
Show resolved
Hide resolved
...ic/src/main/java/org/apache/jackrabbit/oak/plugins/index/elastic/ElasticIndexStatistics.java
Outdated
Show resolved
Hide resolved
oak-search/src/main/java/org/apache/jackrabbit/oak/plugins/index/search/ExtractedTextCache.java
Outdated
Show resolved
Hide resolved
|
@bhabegger good catch, thanks for the PR; can you create a dedicated OAK ticket for it? |
4318b53 to
e61cba0
Compare
Well, in fact it was hinted to me by @thomasmueller as a pending task that I took for my onboarding :) So, I don't have much credit for catching this;) |
e61cba0 to
33271ab
Compare
33271ab to
eb16e23
Compare
| * ThreadFactory which names the threads based on a pattern. The pattern should contain a %d which is replaced by | ||
| * a unique number for each thread generated by this factory. | ||
| */ | ||
| public class NamedThreadFactory implements ThreadFactory { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use the BasicThreadFactory from commons-lang3 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could indeed. However, the dependency to commons-lang3 is not yet in oak-commons module and this would pull it in transitively in other modules where in many of them have it marked as "provided". Being new to this project, I'm not clear on why that could be and if it would be a problem to add the dependency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should add commons-lang3 as a dependency in oak-commons. @reschke wdyt ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added the dependency. @reschke Ok with you ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I probably wouldn't add the dependency. (I wouldn't add indirection or a dependency if the benefit is tiny, as it is here.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@thomasmueller commons-lang3 is already part of oak-commons but as a test dependency. So we are already using it.
eb16e23 to
28c2927
Compare
thomasmueller
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a risk if we change the current behavior, even if the current behavior is not what was intended originally: we could have out-of-memory, concurrency issues etc.
So either the PR should not change the current behavior, or at least, we should have a way to switch back to the old behavior, in case of issues. E.g. with a feature toggle.
Given that we don't currently see issue with the current behavior (other than it's not intended, and can confuse people, etc.), I think we should keep the current behavior.
687a16b to
443d867
Compare
thomasmueller
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some formatting.
oak-run-commons/src/main/java/org/apache/jackrabbit/oak/index/IndexHelper.java
Outdated
Show resolved
Hide resolved
...src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexProviderService.java
Outdated
Show resolved
Hide resolved
...ic/src/main/java/org/apache/jackrabbit/oak/plugins/index/elastic/ElasticIndexStatistics.java
Outdated
Show resolved
Hide resolved
oak-search/src/main/java/org/apache/jackrabbit/oak/plugins/index/search/ExtractedTextCache.java
Outdated
Show resolved
Hide resolved
...mons/src/main/java/org/apache/jackrabbit/oak/commons/internal/concurrent/ExecutorHelper.java
Show resolved
Hide resolved
…e in fact only running one thread)
5f19daa to
60ee9fa
Compare
Some instantiations of ThreadPoolExecutor were setting a different corePoolSize and maxPoolSize even though they were using an unbounded LinkedBlockingQueue. The pattern was repeated multiple times. This PR attempts to fix and mutualize the ThreadPoolExecutor creation code.