ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/main/java/util/concurrent/ForkJoinPool.java
(Generate patch)

Comparing jsr166/src/main/java/util/concurrent/ForkJoinPool.java (file contents):
Revision 1.390 by dl, Sun Dec 27 17:51:00 2020 UTC vs.
Revision 1.391 by dl, Sun Dec 27 20:14:39 2020 UTC

# Line 2653 | Line 2653 | public class ForkJoinPool extends Abstra
2653                  ForkJoinTask<T> f =
2654                      new ForkJoinTask.AdaptedInterruptibleCallable<T>(t);
2655                  futures.add(f);
2656 <                if (!isSaturated())
2657 <                    externalSubmit(f);
2658 <                else if ((mode & SHUTDOWN) == 0)
2659 <                    f.doExec();
2660 <                else
2661 <                    throw new RejectedExecutionException();
2656 >                externalSubmit(f);
2657              }
2658              for (int i = futures.size() - 1; i >= 0; --i)
2659                  ((ForkJoinTask<?>)futures.get(i)).quietlyJoin();
# Line 2681 | Line 2676 | public class ForkJoinPool extends Abstra
2676                  ForkJoinTask<T> f =
2677                      new ForkJoinTask.AdaptedInterruptibleCallable<T>(t);
2678                  futures.add(f);
2679 <                if (!isSaturated())
2685 <                    externalSubmit(f);
2686 <                else if ((mode & SHUTDOWN) == 0)
2687 <                    f.doExec();
2688 <                else
2689 <                    throw new RejectedExecutionException();
2679 >                externalSubmit(f);
2680              }
2681              long startTime = System.nanoTime(), ns = nanos;
2682              boolean timedOut = (ns < 0L);
# Line 2719 | Line 2709 | public class ForkJoinPool extends Abstra
2709          private static final long serialVersionUID = 2838392045355241008L;
2710          @SuppressWarnings("serial") // Conditionally serializable
2711          volatile E result;
2712 <        final AtomicInteger count;              // in case all throw
2713 <        final ForkJoinPool pool;                // to check shutdown while collecting
2714 <        InvokeAnyRoot(int n, ForkJoinPool p) { pool = p; count = new AtomicInteger(n); }
2712 >        final AtomicInteger count;  // in case all throw
2713 >        final ForkJoinPool pool;    // to check shutdown while collecting
2714 >        InvokeAnyRoot(int n, ForkJoinPool p) {
2715 >            pool = p;
2716 >            count = new AtomicInteger(n);
2717 >        }
2718          final void tryComplete(Callable<E> c) { // called by InvokeAnyTasks
2719              Throwable ex = null;
2720 <            boolean failed = (c == null || isCancelled() || (pool != null && pool.mode < 0));
2720 >            boolean failed = (c == null || isCancelled() ||
2721 >                              (pool != null && pool.mode < 0));
2722              if (!failed && !isDone()) {
2723                  try {
2724                      complete(c.call());
# Line 2733 | Line 2727 | public class ForkJoinPool extends Abstra
2727                      failed = true;
2728                  }
2729              }
2730 <            if ((pool != null && pool.mode < 0) || (failed && count.getAndDecrement() <= 1))
2730 >            if ((pool != null && pool.mode < 0) ||
2731 >                (failed && count.getAndDecrement() <= 1))
2732                  trySetThrown(ex != null ? ex : new CancellationException());
2733          }
2734          public final boolean exec()         { return false; } // never forked
# Line 2789 | Line 2784 | public class ForkJoinPool extends Abstra
2784                      throw new NullPointerException();
2785                  InvokeAnyTask<T> f = new InvokeAnyTask<T>(root, c);
2786                  fs.add(f);
2787 <                if (!isSaturated())
2793 <                    externalSubmit(f);
2794 <                else if ((mode & SHUTDOWN) == 0)
2795 <                    f.doExec();
2796 <                else
2797 <                    throw new RejectedExecutionException();
2787 >                externalSubmit(f);
2788                  if (root.isDone())
2789                      break;
2790              }
# Line 2821 | Line 2811 | public class ForkJoinPool extends Abstra
2811                      throw new NullPointerException();
2812                  InvokeAnyTask<T> f = new InvokeAnyTask<T>(root, c);
2813                  fs.add(f);
2814 <                if (!isSaturated())
2825 <                    externalSubmit(f);
2826 <                else if ((mode & SHUTDOWN) == 0)
2827 <                    f.doExec();
2828 <                else
2829 <                    throw new RejectedExecutionException();
2814 >                externalSubmit(f);
2815                  if (root.isDone())
2816                      break;
2817              }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines