1
2
3
4
5
6
7
8
9
10
11
12
13
14 package ch.qos.logback.core.contention;
15
16 import ch.qos.logback.core.testUtil.AbstractMultiThreadedHarness;
17
18 import java.util.concurrent.ThreadPoolExecutor;
19
20 public class WaitOnExecutionMultiThreadedHarness extends AbstractMultiThreadedHarness {
21 ThreadPoolExecutor threadPoolExecutor;
22 int count;
23
24 public WaitOnExecutionMultiThreadedHarness(ThreadPoolExecutor threadPoolExecutor, int count) {
25 this.threadPoolExecutor = threadPoolExecutor;
26 this.count = count;
27
28 }
29
30 @Override
31 public void waitUntilEndCondition() throws InterruptedException {
32 while (threadPoolExecutor.getCompletedTaskCount() < count) {
33 Thread.yield();
34 }
35 }
36 }