File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed
opengrok-indexer/src/main/java/org/opengrok/indexer Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change 1818 */
1919
2020/*
21- * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
21+ * Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved.
2222 */
2323package org .opengrok .indexer .configuration ;
2424
3333public class OpenGrokThreadFactory implements ThreadFactory {
3434 private final String threadPrefix ;
3535
36+ public static final String PREFIX = "OpenGrok-" ;
37+
3638 public OpenGrokThreadFactory (String name ) {
3739 if (!name .endsWith ("-" )) {
3840 threadPrefix = name + "-" ;
@@ -44,7 +46,7 @@ public OpenGrokThreadFactory(String name) {
4446 @ Override
4547 public Thread newThread (@ NotNull Runnable runnable ) {
4648 Thread thread = Executors .defaultThreadFactory ().newThread (runnable );
47- thread .setName ("OpenGrok-" + threadPrefix + thread .getId ());
49+ thread .setName (PREFIX + threadPrefix + thread .getId ());
4850 return thread ;
4951 }
5052}
Original file line number Diff line number Diff line change 2626import java .util .concurrent .ExecutorService ;
2727import java .util .concurrent .Executors ;
2828import java .util .concurrent .ForkJoinPool ;
29+ import java .util .concurrent .ForkJoinWorkerThread ;
2930import java .util .concurrent .ScheduledThreadPoolExecutor ;
3031
3132import org .opengrok .indexer .analysis .Ctags ;
3738import org .opengrok .indexer .util .ObjectFactory ;
3839import org .opengrok .indexer .util .ObjectPool ;
3940
41+ import static java .util .concurrent .ForkJoinPool .defaultForkJoinWorkerThreadFactory ;
42+
4043/**
4144 * Represents a container for executors that enable parallelism for indexing
4245 * across projects and repositories and also within any {@link IndexDatabase}
@@ -230,7 +233,11 @@ private void bounceXrefWatcherExecutor() {
230233
231234 private void createLazyForkJoinPool () {
232235 lzForkJoinPool = LazilyInstantiate .using (() ->
233- new ForkJoinPool (indexingParallelism ));
236+ new ForkJoinPool (indexingParallelism , forkJoinPool -> {
237+ ForkJoinWorkerThread thread = defaultForkJoinWorkerThreadFactory .newThread (forkJoinPool );
238+ thread .setName (OpenGrokThreadFactory .PREFIX + "ForkJoinPool-" + thread .getId ());
239+ return thread ;
240+ }, null , false ));
234241 }
235242
236243 private void createLazyCtagsPool () {
You can’t perform that action at this time.
0 commit comments