TimedCronExecutorService implements CronExecutorService { @Override public ScheduledFuture<?> schedule(Runnable command, long delay, TimeUnit unit) { scheduledOnce.increment(); return delegate.schedule(executionTimer.wrap(command), delay, unit); } TimedCronExecutorService(
      MeterRegistry registry,
      CronExecutorService delegate,
      String executorServiceName,
      Iterable<Tag> tags); @Override void shutdown(); @Override List<Runnable> shutdownNow(); @Override boolean isShutdown(); @Override boolean isTerminated(); @Override boolean awaitTermination(long timeout, TimeUnit unit); @Override Future<T> submit(Callable<T> task); @Override Future<T> submit(Runnable task, T result); @Override Future<?> submit(Runnable task); @Override List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks); @Override List<Future<T>> invokeAll(
      Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit); @Override T invokeAny(Collection<? extends Callable<T>> tasks); @Override T invokeAny(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit); @Override void execute(Runnable command); @Override ScheduledFuture<?> schedule(Runnable command, long delay, TimeUnit unit); @Override ScheduledFuture<V> schedule(Callable<V> callable, long delay, TimeUnit unit); @Override ScheduledFuture<?> scheduleAtFixedRate(
      Runnable command, long initialDelay, long period, TimeUnit unit); @Override ScheduledFuture<?> scheduleWithFixedDelay(
      Runnable command, long initialDelay, long delay, TimeUnit unit); @Override Future<?> schedule(Runnable task, CronExpression expression);  }
@Test public void executor() throws InterruptedException, ParseException { TimedCronExecutorService executorService = new TimedCronExecutorService( registry, new CronThreadPoolExecutor(1), TimedCronExecutorServiceTest.class.getName(), userTags); CountDownLatch lock = new CountDownLatch(1); executorService.schedule( () -> { lock.countDown(); }, new CronExpression(" * * * ? * * *")); lock.await(); assertWithRetry( () -> registry .get("executor.scheduled.cron") .tags(userTags) .tag("name", TimedCronExecutorServiceTest.class.getName()) .counter() .count(), 1.0, 10, 50); assertWithRetry( () -> registry .get("executor") .tags(userTags) .tag("name", TimedCronExecutorServiceTest.class.getName()) .timer() .count(), 1L, 10, 50); }