Package 

Class MoreFutures


  • 
    public class MoreFutures
    
                        

    Utility definitions for operating on futures.

    • Method Detail

      • addFallibleListener

         static <V> void addFallibleListener(ListenableFuture<V> fut, BiConsumer<V, out Object> fn, Executor exec)

        Add fallible listener to future, with executor.

        Parameters:
        fut - future to add listener to
        fn - fallible listener
        exec - executor to invoke {@code fn} on
      • addFallibleListener

         static <V> void addFallibleListener(ListenableFuture<V> fut, BiConsumer<V, out Object> fn)

        Add fallible listener to future.

        Like addFallibleListener, however,this calls {@code fn} on the same thread on which {@code fut} completes on.

        Parameters:
        fut - future to add listener to
        fn - fallible listener
      • cancelAndAwait

         static void cancelAndAwait(@Nullable() Future<out Object> fut)

        Cancel and await completion of future.

        Parameters:
        fut - future to cancel and await completion of or {@code null} if no future
      • cancelAndAwaitAll

         static void cancelAndAwaitAll(Iterable<Future<out Object>> futs)

        Cancel and await completion of zero or more futures.

        Parameters:
        futs - futures to cancel and await completion of