You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@rocketmq.apache.org by "ASF subversion and git services (JIRA)" <ji...@apache.org> on 2017/08/01 07:27:00 UTC

[jira] [Commented] (ROCKETMQ-238) Subsequent executions are suppressed when some key periodic tasks encounter an exception

    [ https://issues.apache.org/jira/browse/ROCKETMQ-238?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16108506#comment-16108506 ] 

ASF subversion and git services commented on ROCKETMQ-238:
----------------------------------------------------------

Commit 9ad9ad064f32470ae7e61ca3c400c680e8ab5ab4 in incubator-rocketmq's branch refs/heads/master from [~Yukon]
[ https://git-wip-us.apache.org/repos/asf?p=incubator-rocketmq.git;h=9ad9ad0 ]

[ROCKETMQ-238] Catch Throwable to avoid error cancel some key scheduled tasks.


> Subsequent executions are suppressed when some key periodic tasks encounter an exception 
> -----------------------------------------------------------------------------------------
>
>                 Key: ROCKETMQ-238
>                 URL: https://issues.apache.org/jira/browse/ROCKETMQ-238
>             Project: Apache RocketMQ
>          Issue Type: Bug
>          Components: rocketmq-broker, rocketmq-remoting, rocketmq-store
>    Affects Versions: 4.0.0-incubating, 4.1.0-incubating
>            Reporter: yukon
>            Assignee: yukon
>             Fix For: 4.2.0-incubating
>
>
> There are many scheduled tasks delegated to ScheduledExecutorService or Timer in broker.
> When the scheduled task encounters an exception, subsequent executions are suppressed, see:
> {code}
> /**
>      * Creates and executes a periodic action that becomes enabled first
>      * after the given initial delay, and subsequently with the given
>      * period; that is executions will commence after
>      * {@code initialDelay} then {@code initialDelay+period}, then
>      * {@code initialDelay + 2 * period}, and so on.
>      * If any execution of the task
>      * encounters an exception, subsequent executions are suppressed.
>      * Otherwise, the task will only terminate via cancellation or
>      * termination of the executor.  If any execution of this task
>      * takes longer than its period, then subsequent executions
>      * may start late, but will not concurrently execute.
>      *
>      * @param command the task to execute
>      * @param initialDelay the time to delay first execution
>      * @param period the period between successive executions
>      * @param unit the time unit of the initialDelay and period parameters
>      * @return a ScheduledFuture representing pending completion of
>      *         the task, and whose {@code get()} method will throw an
>      *         exception upon cancellation
>      * @throws RejectedExecutionException if the task cannot be
>      *         scheduled for execution
>      * @throws NullPointerException if command is null
>      * @throws IllegalArgumentException if period less than or equal to zero
>      */
>     public ScheduledFuture<?> scheduleAtFixedRate(Runnable command,
>                                                   long initialDelay,
>                                                   long period,
>                                                   TimeUnit unit);
> {code}
> So catch Throwable to avoid error canceled our key scheduled tasks.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)