File tree 1 file changed +4
-1
lines changed
src/main/java/com/pivovarit/collectors
1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change 9
9
import java .util .concurrent .LinkedBlockingQueue ;
10
10
import java .util .concurrent .RejectedExecutionException ;
11
11
import java .util .concurrent .Semaphore ;
12
+ import java .util .concurrent .ThreadFactory ;
12
13
import java .util .concurrent .atomic .AtomicBoolean ;
13
14
import java .util .function .Function ;
14
15
import java .util .function .Supplier ;
@@ -25,6 +26,8 @@ final class Dispatcher<T> {
25
26
private final CompletableFuture <Void > completionSignaller = new CompletableFuture <>();
26
27
private final BlockingQueue <Runnable > workingQueue = new LinkedBlockingQueue <>();
27
28
29
+ private final ThreadFactory dispatcherThreadFactory = Thread ::startVirtualThread ;
30
+
28
31
private final Executor executor ;
29
32
private final Semaphore limiter ;
30
33
@@ -72,7 +75,7 @@ static <T> Dispatcher<T> virtual(int permits) {
72
75
73
76
void start () {
74
77
if (!started .getAndSet (true )) {
75
- Thread . startVirtualThread (() -> {
78
+ dispatcherThreadFactory . newThread (() -> {
76
79
try {
77
80
while (true ) {
78
81
try {
You can’t perform that action at this time.
0 commit comments