Uploaded image for project: 'Apache RocketMQ'
  1. Apache RocketMQ
  2. ROCKETMQ-238

Subsequent executions are suppressed when some key periodic tasks encounter an exception

    Details

      Description

      There are many scheduled tasks delegated to ScheduledExecutorService or Timer in broker.

      When the scheduled task encounters an exception, subsequent executions are suppressed, see:

      /**
           * 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);
      

      So catch Throwable to avoid error canceled our key scheduled tasks.

        Attachments

          Activity

            People

            • Assignee:
              Yukon yukon
              Reporter:
              Yukon yukon
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: