Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void main(String[] args) {
- final ForkJoinPool test = new ForkJoinPool(1,
- ForkJoinPool.defaultForkJoinWorkerThreadFactory, null,true);
- final CountDownLatch latch = new CountDownLatch(1);
- test.execute(() -> {
- try {
- System.out.println("Sleeping");
- Future<Double> f = test.submit(() -> {
- latch.await();
- return 0d;
- });
- System.out.println(f.get());
- System.out.println("Waking up");
- } catch (InterruptedException | ExecutionException e) {
- e.printStackTrace();
- });
- System.out.println(test.awaitQuiescence(1, TimeUnit.SECONDS));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement