Class Async


  • final class Async
    extends java.lang.Object
    Static utility methods and classes pertaining to asynchronous operations.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      (package private) static class  Async.AsyncRemovalListener<K,​V>
      A removal listener that asynchronously forwards the value stored in a CompletableFuture if successful to the user-supplied removal listener.
      (package private) static class  Async.AsyncWeigher<K,​V>
      A weigher for asynchronous computations.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private Async()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) static <V> V getIfReady​(java.util.concurrent.CompletableFuture<V> future)
      Returns the current value or null if either not done or failed.
      (package private) static <V> V getWhenSuccessful​(java.util.concurrent.CompletableFuture<V> future)
      Returns the value when completed successfully or null if failed.
      (package private) static boolean isReady​(java.util.concurrent.CompletableFuture<?> future)
      Returns if the future has successfully completed.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Async

        private Async()
    • Method Detail

      • isReady

        static boolean isReady​(@Nullable
                               java.util.concurrent.CompletableFuture<?> future)
        Returns if the future has successfully completed.
      • getIfReady

        @Nullable
        static <V> V getIfReady​(@Nullable
                                java.util.concurrent.CompletableFuture<V> future)
        Returns the current value or null if either not done or failed.
      • getWhenSuccessful

        @Nullable
        static <V> V getWhenSuccessful​(@Nullable
                                       java.util.concurrent.CompletableFuture<V> future)
        Returns the value when completed successfully or null if failed.