(boolean fNap, boolean gNap)
| 30 | |
| 31 | public class SyncOnObject { |
| 32 | static void test(boolean fNap, boolean gNap) { |
| 33 | DualSynch ds = new DualSynch(); |
| 34 | List<CompletableFuture<Void>> cfs = |
| 35 | Arrays.stream(new Runnable[] { |
| 36 | () -> ds.f(fNap), () -> ds.g(gNap) }) |
| 37 | .map(CompletableFuture::runAsync) |
| 38 | .collect(Collectors.toList()); |
| 39 | cfs.forEach(CompletableFuture::join); |
| 40 | ds.trace.forEach(System.out::println); |
| 41 | } |
| 42 | public static void main(String[] args) { |
| 43 | test(true, false); |
| 44 | System.out.println("****"); |