Class FutureUtils


  • public final class FutureUtils
    extends java.lang.Object
    A set of utilities for interacting with Future.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T> T awaitResult​(java.util.concurrent.Future<T> future)
      Await the completion of the passed Future and return its result.
      static void awaitTermination​(java.util.concurrent.Future<java.lang.Void> future)
      Await the completion of the passed Future.
      • Methods inherited from class java.lang.Object

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

      • awaitTermination

        public static void awaitTermination​(java.util.concurrent.Future<java.lang.Void> future)
        Await the completion of the passed Future.
        Parameters:
        future - Future to await termination.
      • awaitResult

        public static <T> T awaitResult​(java.util.concurrent.Future<T> future)
        Await the completion of the passed Future and return its result.
        Type Parameters:
        T - the result type.
        Parameters:
        future - Future to await completion.
        Returns:
        the result of the Future.