@Override
 public ScheduledFuture<?> schedule(Runnable task, Trigger trigger) {
   ScheduledExecutorService executor = getScheduledExecutor();
   try {
     ErrorHandler errorHandler =
         (this.errorHandler != null ? this.errorHandler : TaskUtils.getDefaultErrorHandler(true));
     return new ReschedulingRunnable(task, trigger, executor, errorHandler).schedule();
   } catch (RejectedExecutionException ex) {
     throw new TaskRejectedException(
         "Executor [" + executor + "] did not accept task: " + task, ex);
   }
 }
 private Runnable errorHandlingTask(Runnable task, boolean isRepeatingTask) {
   return TaskUtils.decorateTaskWithErrorHandler(task, this.errorHandler, isRepeatingTask);
 }