We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ff52cee commit f0671d8Copy full SHA for f0671d8
src/main/java/com/pivovarit/collectors/Dispatcher.java
@@ -50,12 +50,7 @@ final class Dispatcher<T> {
50
}
51
52
CompletableFuture<Void> start() {
53
- if (!started) {
54
- started = true;
55
- } else {
56
- return completionSignaller;
57
- }
58
-
+ started = true;
59
dispatcher.execute(withExceptionHandling(() -> {
60
while (!Thread.currentThread().isInterrupted()) {
61
Runnable task = workingQueue.take();
@@ -73,16 +68,14 @@ CompletableFuture<Void> start() {
73
68
}, executor);
74
69
75
70
}));
76
- try {
77
78
- } finally {
79
- dispatcher.shutdown();
80
71
+
72
+ return completionSignaller;
81
82
83
void stop() {
84
if (started) {
85
workingQueue.add(POISON_PILL);
+ dispatcher.shutdown();
86
87
88
0 commit comments