Code example for FutureTask

Methods: get

0
     * @throws ExecutionException If the computation threw an exception. 
     * @throws InterruptedException If the current thread was interrupted 
     *         while waiting. 
     */ 
    public final Result get() throws InterruptedException, ExecutionException { 
        return mFuture.get();
    } 
 
    /** 
     * Waits if necessary for at most the given time for the computation 
     * to complete, and then retrieves its result. 
     * 
     * @param timeout Time to wait before cancelling the operation. 
     * @param unit The time unit for the timeout. 
     * 
     * @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.