mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-10-26 14:00:26 +00:00
Waited for occupied dispatcher in test
- Concurrency test starts generation only after every burst worker is blocked
This commit is contained in:
1 parent
60eec4e2ee
commit
c3b3f1d8aa
1 file changed
+10
-1
+10
-1
@@ -526,10 +526,13 @@ public class MatterGeneratorConcurrencyTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static List<Future<?>> occupyDispatcher(CountDownLatch release) {
|
private static List<Future<?>> occupyDispatcher(CountDownLatch release) {
|
||||||
int blockers = Math.max(1, MultiBurst.burst.parallelism()) * 4;
|
int parallelism = Math.max(1, MultiBurst.burst.parallelism());
|
||||||
|
int blockers = parallelism * 4;
|
||||||
|
CountDownLatch started = new CountDownLatch(parallelism);
|
||||||
List<Future<?>> futures = new ArrayList<>(blockers);
|
List<Future<?>> futures = new ArrayList<>(blockers);
|
||||||
for (int index = 0; index < blockers; index++) {
|
for (int index = 0; index < blockers; index++) {
|
||||||
futures.add(MultiBurst.burst.submit(() -> {
|
futures.add(MultiBurst.burst.submit(() -> {
|
||||||
|
started.countDown();
|
||||||
try {
|
try {
|
||||||
assertTrue(release.await(30L, TimeUnit.SECONDS));
|
assertTrue(release.await(30L, TimeUnit.SECONDS));
|
||||||
} catch (InterruptedException interruption) {
|
} catch (InterruptedException interruption) {
|
||||||
@@ -537,6 +540,12 @@ public class MatterGeneratorConcurrencyTest {
|
|||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
|
assertTrue(started.await(30L, TimeUnit.SECONDS));
|
||||||
|
} catch (InterruptedException interruption) {
|
||||||
|
Thread.currentThread().interrupt();
|
||||||
|
throw new IllegalStateException("Interrupted while occupying the burst dispatcher.", interruption);
|
||||||
|
}
|
||||||
return futures;
|
return futures;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user