Waits if necessary for at most the given time for the computation
to complete, and then retrieves its result, if available.
@param timeout the maximum time to wait
@param unit the time unit of the timeout argument
@return the computed result
@throws CancellationException if the computation was cancelled
@throws ExecutionException if the computation threw an
exception
@throws InterruptedException if the current thread was interrupted
while waiting
@throws TimeoutException if the wait timed out
Waits if necessary for at most the given time for the computation to complete, and then retrieves its result, if available.
@param timeout the maximum time to wait @param unit the time unit of the timeout argument @return the computed result @throws CancellationException if the computation was cancelled @throws ExecutionException if the computation threw an exception @throws InterruptedException if the current thread was interrupted while waiting @throws TimeoutException if the wait timed out