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

Comparing jsr166/src/main/java/util/concurrent/ScheduledThreadPoolExecutor.java (file contents):
Revision 1.110 by jsr166, Thu Mar 30 20:11:50 2017 UTC vs.
Revision 1.111 by jsr166, Thu Mar 30 20:38:51 2017 UTC

# Line 50 | Line 50 | import java.util.concurrent.locks.Reentr
50   * <a href="package-summary.html#MemoryVisibility"><i>happen-before</i></a>
51   * those of subsequent ones.
52   *
53 * <p>Executions of a periodic task continue until one of the
54 * following happens, when further executions are suppressed and the
55 * task's future is completed:
56 * <ul>
57 * <li>{@link #shutdown} is called and the {@linkplain
58 * #getContinueExistingPeriodicTasksAfterShutdownPolicy policy on
59 * whether to continue after shutdown} is not set true)
60 * <li>{@link #shutdownNow} is called
61 * <li>the task's future is {@linkplain Future#cancel cancelled}
62 * <li>an execution of the task terminates abruptly with an exception;
63 * in this case calling {@link Future#get()} will throw an {@link
64 * ExecutionException} holding the exception as its cause.  In all
65 * other cases {@code get()} will throw {@link CancellationException};
66 * a periodic task's future never completes normally.
67 * </ul>
68 *
53   * <p>While this class inherits from {@link ThreadPoolExecutor}, a few
54   * of the inherited tuning methods are not useful for it. In
55   * particular, because it acts as a fixed-sized pool using
# Line 568 | Line 552 | public class ScheduledThreadPoolExecutor
552      }
553  
554      /**
555 +     * Submits a periodic action that becomes enabled first after the
556 +     * given initial delay, and subsequently with the given period;
557 +     * that is, executions will commence after
558 +     * {@code initialDelay}, then {@code initialDelay + period}, then
559 +     * {@code initialDelay + 2 * period}, and so on.
560 +     *
561 +     * <p>The sequence of task executions continues indefinitely until
562 +     * one of the following exceptional completions occur:
563 +     * <ul>
564 +     * <li>The task is {@linkplain Future#cancel explicitly cancelled}
565 +     * via the returned future.
566 +     * <li>Method {@link #shutdown} is called and the {@linkplain
567 +     * #getContinueExistingPeriodicTasksAfterShutdownPolicy policy on
568 +     * whether to continue after shutdown} is not set true, or method
569 +     * {@link #shutdownNow} is called; also resulting in task
570 +     * cancellation.
571 +     * <li>An execution of the task throws an exception.  In this case
572 +     * calling {@link Future#get() get} on the returned future will throw
573 +     * {@link ExecutionException}, holding the exception as its cause.
574 +     * </ul>
575 +     * Subsequent executions are suppressed.  Subsequent calls to
576 +     * {@link Future#isDone isDone()} on the returned future will
577 +     * return {@code true}.
578 +     *
579 +     * <p>If any execution of this task takes longer than its period, then
580 +     * subsequent executions may start late, but will not concurrently
581 +     * execute.
582 +     *
583       * @throws RejectedExecutionException {@inheritDoc}
584       * @throws NullPointerException       {@inheritDoc}
585       * @throws IllegalArgumentException   {@inheritDoc}
# Line 593 | Line 605 | public class ScheduledThreadPoolExecutor
605      }
606  
607      /**
608 +     * Submits a periodic action that becomes enabled first after the
609 +     * given initial delay, and subsequently with the given delay
610 +     * between the termination of one execution and the commencement of
611 +     * the next.
612 +     *
613 +     * <p>The sequence of task executions continues indefinitely until
614 +     * one of the following exceptional completions occur:
615 +     * <ul>
616 +     * <li>The task is {@linkplain Future#cancel explicitly cancelled}
617 +     * via the returned future.
618 +     * <li>Method {@link #shutdown} is called and the {@linkplain
619 +     * #getContinueExistingPeriodicTasksAfterShutdownPolicy policy on
620 +     * whether to continue after shutdown} is not set true, or method
621 +     * {@link #shutdownNow} is called; also resulting in task
622 +     * cancellation.
623 +     * <li>An execution of the task throws an exception.  In this case
624 +     * calling {@link Future#get() get} on the returned future will throw
625 +     * {@link ExecutionException}, holding the exception as its cause.
626 +     * </ul>
627 +     * Subsequent executions are suppressed.  Subsequent calls to
628 +     * {@link Future#isDone isDone()} on the returned future will
629 +     * return {@code true}.
630 +     *
631       * @throws RejectedExecutionException {@inheritDoc}
632       * @throws NullPointerException       {@inheritDoc}
633       * @throws IllegalArgumentException   {@inheritDoc}
# Line 670 | Line 705 | public class ScheduledThreadPoolExecutor
705      /**
706       * Sets the policy on whether to continue executing existing
707       * periodic tasks even when this executor has been {@code shutdown}.
708 +     * In this case, executions will continue until {@code shutdownNow}
709 +     * or the policy is set to {@code false} when already shutdown.
710       * This value is by default {@code false}.
711       *
675     * <p>If the policy is set to {@code true}, periodic tasks will
676     * continue executing until one of the following happens:
677     *
678     * <ul>
679     * <li>{@link #shutdownNow} is called
680     * <li>the policy is set to {@code false} when already shutdown
681     * <li>the task's future is {@linkplain Future#cancel cancelled}
682     * <li>an execution of the task terminates with an exception
683     * </ul>
684     *
712       * @param value if {@code true}, continue after shutdown, else don't
713       * @see #getContinueExistingPeriodicTasksAfterShutdownPolicy
714       */
# Line 694 | Line 721 | public class ScheduledThreadPoolExecutor
721      /**
722       * Gets the policy on whether to continue executing existing
723       * periodic tasks even when this executor has been {@code shutdown}.
724 +     * In this case, executions will continue until {@code shutdownNow}
725 +     * or the policy is set to {@code false} when already shutdown.
726       * This value is by default {@code false}.
727       *
699     * <p>If the policy is set to {@code true}, periodic tasks will
700     * continue executing until one of the following happens:
701     *
702     * <ul>
703     * <li>{@link #shutdownNow} is called
704     * <li>the policy is set to {@code false} when already shutdown
705     * <li>the task's future is {@linkplain Future#cancel cancelled}
706     * <li>an execution of the task terminates with an exception
707     * </ul>
708     *
728       * @return {@code true} if will continue after shutdown
729       * @see #setContinueExistingPeriodicTasksAfterShutdownPolicy
730       */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines