@ Override public TOutput get ( final long timeout , final TimeUnit unit ) throws InterruptedException , ExecutionException , TimeoutException , CancellationException { if ( ! countDownLatch . await ( timeout , unit ) ) { throw new TimeoutException ( "Waiting for the results of the task timed out. Timeout = " + timeout + " in time units: " + unit ) ; } return get ( ) ; }
Wait a certain period of time for the result of the task .