@Override
  public Future<?> schedule(Executor executor, Runnable command, long delay, TimeUnit unit) {
    requireNonNull(executor);
    requireNonNull(command);
    requireNonNull(unit);

    if (scheduledExecutorService.isShutdown()) {
      return DisabledFuture.INSTANCE;
    }
    return scheduledExecutorService.schedule(() -> {
      try {
        executor.execute(command);
      } catch (Throwable t) {
        logger.log(Level.WARNING, "Exception thrown when submitting scheduled task", t);
        throw t;
      }
    }, delay, unit);
  }
@Test
  public void scheduledExecutorService_shutdown() {
    ScheduledExecutorService scheduledExecutor = Mockito.mock();
    Executor executor = Mockito.mock();

    when(scheduledExecutor.isShutdown()).thenReturn(true);
    var scheduler = Scheduler.forScheduledExecutorService(scheduledExecutor);
    var future = scheduler.schedule(executor, () -> {}, 1L, TimeUnit.MINUTES);
    assertThat(future).isSameInstanceAs(DisabledFuture.INSTANCE);

    verify(scheduledExecutor).isShutdown();
    verifyNoMoreInteractions(scheduledExecutor);
    verifyNoInteractions(executor);
  }