Class FutureIO
java.lang.Object
org.apache.parquet.hadoop.util.wrapped.io.FutureIO
Methods to work with futures, based on.
org.apache.hadoop.util.functional.FutureIO.
These methods are used in production code.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> TawaitFuture(Future<T> future) Given a future, evaluate it.static <T> TawaitFuture(Future<T> future, long timeout, TimeUnit unit) Given a future, evaluate it.static IOExceptionFrom the inner cause of an execution exception, extract the inner cause to an IOException, raising Errors immediately.
-
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 evaluatetimeout- timeout to waitunit- time unit.- Returns:
- the result, if all went well.
- Throws:
InterruptedIOException- future was interruptedIOException- if something went wrongRuntimeException- any nested RTE thrownTimeoutException- 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 interruptedIOException- if something went wrongRuntimeException- any nested RTE thrown
-
unwrapInnerException
From the inner cause of an execution exception, extract the inner cause to an IOException, raising Errors immediately.- If it is an IOE: Return.
- If it is a
UncheckedIOException: return the cause - Completion/Execution Exceptions: extract and repeat
- If it is an RTE or Error: throw.
- Any other type: wrap in an IOE
- If there is no cause: wrap the passed exception by an IOE
- 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.
-