public static < V > Optional < V > tryGetFutureValue ( Future < V > future , int timeout , TimeUnit timeUnit ) { return tryGetFutureValue ( future , timeout , timeUnit , RuntimeException . class ) ; }
Waits for the the value from the future for the specified time . If the future value is null an empty Optional is still returned and in this case the caller must check the future directly for the null value . If the future is failed the exception is thrown directly if unchecked or wrapped in a RuntimeException . If the thread is interrupted the thread interruption flag is set and the original InterruptedException is wrapped in a RuntimeException and thrown .