public T get ( long timeout , TimeUnit unit ) throws InterruptedException , ExecutionException , TimeoutException { long nanos = unit . toNanos ( timeout ) ; Object r ; if ( ( r = result ) == null ) r = timedGet ( nanos ) ; return ( T ) reportGet ( r ) ; }
Waits if necessary for at most the given time for this future to complete and then returns its result if available .