android/guava/src/com/google/common/cache/CacheLoader.java
@GwtIncompatible // Executor + Futures
  public static <K, V> CacheLoader<K, V> asyncReloading(
      final CacheLoader<K, V> loader, final Executor executor) {
    checkNotNull(loader);
    checkNotNull(executor);
    return new CacheLoader<K, V>() {
      @Override
      public V load(K key) throws Exception {
        return loader.load(key);
      }

      @Override
      public ListenableFuture<V> reload(final K key, final V oldValue) throws Exception {
        ListenableFutureTask<V> task =
            ListenableFutureTask.create(
                new Callable<V>() {
                  @Override
                  public V call() throws Exception {
                    return loader.reload(key, oldValue).get();
                  }
                });
        executor.execute(task);
        return task;
      }

      @Override
      public Map<K, V> loadAll(Iterable<? extends K> keys) throws Exception {
        return loader.loadAll(keys);
      }
    };
  }
@GwtIncompatible // Executor + Futures
  public static <K, V> CacheLoader<K, V> asyncReloading(
      final CacheLoader<K, V> loader, final Executor executor) {
    checkNotNull(loader);
    checkNotNull(executor);
    return new CacheLoader<K, V>() {
      @Override
      public V load(K key) throws Exception {
        return loader.load(key);
      }

      @Override
      public ListenableFuture<V> reload(final K key, final V oldValue) throws Exception {
        ListenableFutureTask<V> task =
            ListenableFutureTask.create(
                new Callable<V>() {
                  @Override
                  public V call() throws Exception {
                    return loader.reload(key, oldValue).get();
                  }
                });
        executor.execute(task);
        return task;
      }

      @Override
      public Map<K, V> loadAll(Iterable<? extends K> keys) throws Exception {
        return loader.loadAll(keys);
      }
    };
  }
@ GwtIncompatible // Executor + Futures public static < K , V > CacheLoader < K , V > asyncReloading ( final CacheLoader < K , V > loader , final Executor executor ) { checkNotNull ( loader ) ; checkNotNull ( executor ) ; return new CacheLoader < K , V > ( ) { @ Override public V load ( K key ) throws Exception { return loader . load ( key ) ; } @ Override public ListenableFuture < V > reload ( final K key , final V oldValue ) throws Exception { ListenableFutureTask < V > task = ListenableFutureTask . create ( new Callable < V > ( ) { @ Override public V call ( ) throws Exception { return loader . reload ( key , oldValue ) . get ( ) ; } } ) ; executor . execute ( task ) ; return task ; } @ Override public Map < K , V > loadAll ( Iterable < ? extends K > keys ) throws Exception { return loader . loadAll ( keys ) ; } } ; }
Returns a {@code CacheLoader} which wraps {@code loader}, executing calls to {@link
CacheLoader#reload} using {@code executor}.

<p>This method is useful only when {@code loader.reload} has a synchronous implementation, such
as {@linkplain #reload the default implementation}.

@since 17.0
Returns a { @code CacheLoader } which wraps { @code loader } executing calls to { @link CacheLoader#reload } using { @code executor } .