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 18
18
*/
19
19
20
20
/*
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.
22
22
*/
23
23
package org .opengrok .indexer .configuration ;
24
24
33
33
public class OpenGrokThreadFactory implements ThreadFactory {
34
34
private final String threadPrefix ;
35
35
36
+ public static final String PREFIX = "OpenGrok-" ;
37
+
36
38
public OpenGrokThreadFactory (String name ) {
37
39
if (!name .endsWith ("-" )) {
38
40
threadPrefix = name + "-" ;
@@ -44,7 +46,7 @@ public OpenGrokThreadFactory(String name) {
44
46
@ Override
45
47
public Thread newThread (@ NotNull Runnable runnable ) {
46
48
Thread thread = Executors .defaultThreadFactory ().newThread (runnable );
47
- thread .setName ("OpenGrok-" + threadPrefix + thread .getId ());
49
+ thread .setName (PREFIX + threadPrefix + thread .getId ());
48
50
return thread ;
49
51
}
50
52
}
Original file line number Diff line number Diff line change 26
26
import java .util .concurrent .ExecutorService ;
27
27
import java .util .concurrent .Executors ;
28
28
import java .util .concurrent .ForkJoinPool ;
29
+ import java .util .concurrent .ForkJoinWorkerThread ;
29
30
import java .util .concurrent .ScheduledThreadPoolExecutor ;
30
31
31
32
import org .opengrok .indexer .analysis .Ctags ;
37
38
import org .opengrok .indexer .util .ObjectFactory ;
38
39
import org .opengrok .indexer .util .ObjectPool ;
39
40
41
+ import static java .util .concurrent .ForkJoinPool .defaultForkJoinWorkerThreadFactory ;
42
+
40
43
/**
41
44
* Represents a container for executors that enable parallelism for indexing
42
45
* across projects and repositories and also within any {@link IndexDatabase}
@@ -230,7 +233,11 @@ private void bounceXrefWatcherExecutor() {
230
233
231
234
private void createLazyForkJoinPool () {
232
235
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 ));
234
241
}
235
242
236
243
private void createLazyCtagsPool () {
You can’t perform that action at this time.
0 commit comments