code: public final void schedule(final T task, final long period, final TimeUnit unit) throws IOException {
      Preconditions.checkArgument(this.isStarted, "TaskScheduler is not started");
      try {
        CancellableTask<K, T> cancellableTask =
            this.cancellableTaskMap.get(task.getKey(), new Callable<CancellableTask<K, T>>() {
              @Override
              public CancellableTask<K, T> call() {
                return scheduleImpl(task, period, unit);
              }
            });
        if (cancellableTask.getScheduledTask() != task) {
          throw new IOException("Failed to schedule task with duplicate key");
        }
      } catch (ExecutionException e) {
        throw new IOException("Failed to schedule task", e);
      }
    }
docs: Schedules a subclass of {@link ScheduledTask} to run periodically.
  
  @param task the subclass of {@link ScheduledTask} to run every period
  @param period the period between successive executions of the task
  @param unit the time unit of the initialDelay and period parameters