bhabegger commented on code in PR #2679:
URL: https://github.com/apache/jackrabbit-oak/pull/2679#discussion_r2685756033
##########
oak-run-commons/src/main/java/org/apache/jackrabbit/oak/index/IndexHelper.java:
##########
@@ -174,25 +172,7 @@ protected void bindIndexInfoProviders(IndexInfoServiceImpl
indexInfoService) {
}
private ThreadPoolExecutor createExecutor() {
- ThreadPoolExecutor executor = new ThreadPoolExecutor(0, 5, 60L,
TimeUnit.SECONDS,
- new LinkedBlockingQueue<Runnable>(), new ThreadFactory() {
- private final AtomicInteger counter = new AtomicInteger();
- private final Thread.UncaughtExceptionHandler handler =
- (t, e) -> log.warn("Error occurred in asynchronous
processing ", e);
-
- @Override
- public Thread newThread(@NotNull Runnable r) {
- Thread thread = new Thread(r, createName());
- thread.setDaemon(true);
- thread.setPriority(Thread.MIN_PRIORITY);
- thread.setUncaughtExceptionHandler(handler);
- return thread;
- }
-
- private String createName() {
- return "oak-lucene-" + counter.getAndIncrement();
- }
- });
+ ThreadPoolExecutor executor = ExecutorHelper.linkedQueueExecutor(5,
"oak-lucene-%d", (t, e) -> log.warn("Error occurred in asynchronous processing
", e));
Review Comment:
@nit0906 What was the intent here ? I'm guessing 0 threads when no load and
up to 5 threads when under load. Currently we have 0 threads initially, 1
thread gets created when load arrives, it will never reach 5 (as per the doc),
and it will go back down to 0 threads after when the keep alive timeout is
reached.
What is more important ?
- Having 5 threads under load (but then systematically 5 threads and never
0)
- Having 0 threads when there is no load (but then only having 1 thread
under load)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]