50 |
|
* <a href="package-summary.html#MemoryVisibility"><i>happen-before</i></a> |
51 |
|
* those of subsequent ones. |
52 |
|
* |
53 |
+ |
* <p>Calling {@link Future#get} on a periodic task's future will |
54 |
+ |
* never return normally. If an execution of a periodic task |
55 |
+ |
* throws an exception, further executions are suppressed and |
56 |
+ |
* {@code get()} will throw an {@link ExecutionException} holding the |
57 |
+ |
* exception as its cause. Otherwise, {@code get()} will block and |
58 |
+ |
* executions continue indefinitely until the task is cancelled, when |
59 |
+ |
* it will throw {@link CancellationException}. Such cancellations |
60 |
+ |
* occur when the future is cancelled, on {@link #shutdownNow}, or on |
61 |
+ |
* {@link #shutdown} unless the {@linkplain |
62 |
+ |
* #getContinueExistingPeriodicTasksAfterShutdownPolicy policy on |
63 |
+ |
* whether to continue after shutdown} is set true. |
64 |
+ |
* |
65 |
|
* <p>While this class inherits from {@link ThreadPoolExecutor}, a few |
66 |
|
* of the inherited tuning methods are not useful for it. In |
67 |
|
* particular, because it acts as a fixed-sized pool using |
666 |
|
/** |
667 |
|
* Sets the policy on whether to continue executing existing |
668 |
|
* periodic tasks even when this executor has been {@code shutdown}. |
657 |
– |
* In this case, these tasks will only terminate upon |
658 |
– |
* {@code shutdownNow} or after setting the policy to |
659 |
– |
* {@code false} when already shutdown. |
669 |
|
* This value is by default {@code false}. |
670 |
|
* |
671 |
+ |
* <p>If the policy is set to {@code true}, periodic tasks will |
672 |
+ |
* continue executing until one of the following happens: |
673 |
+ |
* |
674 |
+ |
* <ul> |
675 |
+ |
* <li>{@link #shutdownNow} is called |
676 |
+ |
* <li>the policy is set to {@code false} when already shutdown |
677 |
+ |
* <li>the task is {@linkplain Future#cancel cancelled} |
678 |
+ |
* <li>an execution of the task terminates with an exception |
679 |
+ |
* </ul> |
680 |
+ |
* |
681 |
|
* @param value if {@code true}, continue after shutdown, else don't |
682 |
|
* @see #getContinueExistingPeriodicTasksAfterShutdownPolicy |
683 |
|
*/ |
690 |
|
/** |
691 |
|
* Gets the policy on whether to continue executing existing |
692 |
|
* periodic tasks even when this executor has been {@code shutdown}. |
674 |
– |
* In this case, these tasks will only terminate upon |
675 |
– |
* {@code shutdownNow} or after setting the policy to |
676 |
– |
* {@code false} when already shutdown. |
693 |
|
* This value is by default {@code false}. |
694 |
|
* |
695 |
+ |
* <p>If the policy is set to {@code true}, periodic tasks will |
696 |
+ |
* continue executing until one of the following happens: |
697 |
+ |
* |
698 |
+ |
* <ul> |
699 |
+ |
* <li>{@link #shutdownNow} is called |
700 |
+ |
* <li>the policy is set to {@code false} when already shutdown |
701 |
+ |
* <li>the task is {@linkplain Future#cancel cancelled} |
702 |
+ |
* <li>an execution of the task terminates with an exception |
703 |
+ |
* </ul> |
704 |
+ |
* |
705 |
|
* @return {@code true} if will continue after shutdown |
706 |
|
* @see #setContinueExistingPeriodicTasksAfterShutdownPolicy |
707 |
|
*/ |