Class FutureUtils

java.lang.Object
org.elasticsearch.common.util.concurrent.FutureUtils

public class FutureUtils
extends java.lang.Object
  • Constructor Summary

    Constructors 
    Constructor Description
    FutureUtils()  
  • Method Summary

    Modifier and Type Method Description
    static boolean cancel​(java.util.concurrent.Future<?> toCancel)
    Cancel execution of this future without interrupting a running thread.
    static <T> T get​(java.util.concurrent.Future<T> future)
    Calls Future.get() without the checked exceptions.
    static <T> T get​(java.util.concurrent.Future<T> future, long timeout, java.util.concurrent.TimeUnit unit)
    Calls Future.get(long, TimeUnit) without the checked exceptions.
    static java.lang.RuntimeException rethrowExecutionException​(java.util.concurrent.ExecutionException e)  

    Methods inherited from class java.lang.Object

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

  • Method Details

    • cancel

      public static boolean cancel​(@Nullable java.util.concurrent.Future<?> toCancel)
      Cancel execution of this future without interrupting a running thread. See Future.cancel(boolean) for details.
      Parameters:
      toCancel - the future to cancel
      Returns:
      false if the future could not be cancelled, otherwise true
    • get

      public static <T> T get​(java.util.concurrent.Future<T> future)
      Calls Future.get() without the checked exceptions.
      Type Parameters:
      T - the type returned
      Parameters:
      future - to dereference
      Returns:
      the value of the future
    • get

      public static <T> T get​(java.util.concurrent.Future<T> future, long timeout, java.util.concurrent.TimeUnit unit)
      Calls Future.get(long, TimeUnit) without the checked exceptions.
      Type Parameters:
      T - the type returned
      Parameters:
      future - to dereference
      timeout - to wait
      unit - for timeout
      Returns:
      the value of the future
    • rethrowExecutionException

      public static java.lang.RuntimeException rethrowExecutionException​(java.util.concurrent.ExecutionException e)