View Javadoc

1   package com.atlassian.vcache.internal.core.metrics;
2   
3   import java.util.concurrent.CompletableFuture;
4   import java.util.concurrent.CompletionStage;
5   import java.util.function.Consumer;
6   
7   /**
8    * Provides helper methods for the timed wrappers.
9    *
10   * @since 1.0.0
11   */
12  class TimedUtils {
13      static <T> void whenCompletableFuture(CompletionStage<T> stage, Consumer<CompletableFuture<T>> handle) {
14          if (stage instanceof CompletableFuture) {
15              handle.accept((CompletableFuture<T>) stage);
16          }
17      }
18  }