java.lang.Object
org.apache.parquet.hadoop.util.wrapped.io.FutureIO

public final class FutureIO extends Object
Methods to work with futures, based on. org.apache.hadoop.util.functional.FutureIO. These methods are used in production code.
  • Constructor Details

    • FutureIO

      public FutureIO()
  • Method Details

    • awaitFuture

      public static <T> T awaitFuture(Future<T> future, long timeout, TimeUnit unit) throws InterruptedIOException, IOException, RuntimeException, TimeoutException
      Given a future, evaluate it.

      Any exception generated in the future is extracted and rethrown.

      Type Parameters:
      T - type of the result.
      Parameters:
      future - future to evaluate
      timeout - timeout to wait
      unit - time unit.
      Returns:
      the result, if all went well.
      Throws:
      InterruptedIOException - future was interrupted
      IOException - if something went wrong
      RuntimeException - any nested RTE thrown
      TimeoutException - the future timed out.
    • awaitFuture

      public static <T> T awaitFuture(Future<T> future) throws InterruptedIOException, IOException, RuntimeException
      Given a future, evaluate it.

      Any exception generated in the future is extracted and rethrown.

      Type Parameters:
      T - type of the result.
      Parameters:
      future - future to evaluate
      Returns:
      the result, if all went well.
      Throws:
      InterruptedIOException - future was interrupted
      IOException - if something went wrong
      RuntimeException - any nested RTE thrown
    • unwrapInnerException

      public static IOException unwrapInnerException(Throwable e)
      From the inner cause of an execution exception, extract the inner cause to an IOException, raising Errors immediately.
      1. If it is an IOE: Return.
      2. If it is a UncheckedIOException: return the cause
      3. Completion/Execution Exceptions: extract and repeat
      4. If it is an RTE or Error: throw.
      5. Any other type: wrap in an IOE
      6. If there is no cause: wrap the passed exception by an IOE
      Recursively handles wrapped Execution and Completion Exceptions in case something very complicated has happened.
      Parameters:
      e - exception.
      Returns:
      an IOException extracted or built from the cause.
      Throws:
      RuntimeException - if that is the inner cause.
      Error - if that is the inner cause.