Small code cleanups and switch more stuff to adventure

This commit is contained in:
Andrew Steinborn
2020-07-19 18:23:47 -04:00
parent 21ad6a433f
commit f9f60e1489
19 changed files with 75 additions and 48 deletions

View File

@@ -21,11 +21,13 @@ public class OnceTest {
@Test
void contendedOnce() throws Exception {
ExecutorService service = Executors.newFixedThreadPool(10);
int threadsForTest = 25;
ExecutorService service = Executors.newFixedThreadPool(threadsForTest);
AtomicInteger i = new AtomicInteger();
Once once = new Once();
CountDownLatch latch = new CountDownLatch(10);
for (int i1 = 0; i1 < 10; i1++) {
CountDownLatch latch = new CountDownLatch(threadsForTest);
for (int i1 = 0; i1 < threadsForTest; i1++) {
service.execute(() -> {
once.run(i::incrementAndGet);
latch.countDown();