mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-10-26 22:10:18 +00:00
Bounded routing test cleanup
- Shutdown assertions interrupt and drain workers before fallback router close
This commit is contained in:
1 parent
fb4585b62d
commit
9fdb5615d6
1 file changed
+4
-2
+4
-2
@@ -400,8 +400,9 @@ public final class GenerationHistoryRuntimeRouterTest {
|
|||||||
ExecutorService executor = Executors.newFixedThreadPool(9);
|
ExecutorService executor = Executors.newFixedThreadPool(9);
|
||||||
CountDownLatch routing = new CountDownLatch(8);
|
CountDownLatch routing = new CountDownLatch(8);
|
||||||
CompletableFuture<?>[] workers = new CompletableFuture<?>[8];
|
CompletableFuture<?>[] workers = new CompletableFuture<?>[8];
|
||||||
try (GenerationHistoryRuntimeRouter router = GenerationHistoryRuntimeRouter.attach(
|
GenerationHistoryRuntimeRouter router = GenerationHistoryRuntimeRouter.attach(
|
||||||
engine, history, (ignored, x, z) -> signature(x, z), runtimes)) {
|
engine, history, (ignored, x, z) -> signature(x, z), runtimes);
|
||||||
|
try {
|
||||||
for (int i = 0; i < workers.length; i++) {
|
for (int i = 0; i < workers.length; i++) {
|
||||||
workers[i] = CompletableFuture.runAsync(() -> routeUntilClosed(router, routing), executor);
|
workers[i] = CompletableFuture.runAsync(() -> routeUntilClosed(router, routing), executor);
|
||||||
}
|
}
|
||||||
@@ -413,6 +414,7 @@ public final class GenerationHistoryRuntimeRouterTest {
|
|||||||
} finally {
|
} finally {
|
||||||
executor.shutdownNow();
|
executor.shutdownNow();
|
||||||
assertTrue(executor.awaitTermination(5, TimeUnit.SECONDS));
|
assertTrue(executor.awaitTermination(5, TimeUnit.SECONDS));
|
||||||
|
router.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user