Code example for FutureTask

Methods: get

     *         while waiting. 
     * @throws TimeoutException If the wait timed out. 
    public final Result get(long timeout, TimeUnit unit) throws InterruptedException,
            ExecutionException, TimeoutException { 
        return mFuture.get(timeout, unit);
     * Executes the task with the specified parameters. The task returns 
     * itself (this) so that the caller can keep a reference to it. 
     * <p>Note: this function schedules the task on a queue for a single background 
     * thread or pool of threads depending on the platform version.  When first 
     * introduced, AsyncTasks were executed serially on a single background thread. 
     * Starting with {@link android.os.Build.VERSION_CODES#DONUT}, this was changed 
     * to a pool of threads allowing multiple tasks to operate in parallel. Starting 
     * {@link android.os.Build.VERSION_CODES#HONEYCOMB}, tasks are back to being 
     * executed on a single thread to avoid common application errors caused 
     * by parallel execution.  If you truly want parallel execution, you can use 
Stop searching for code, let great code find you!  Add Codota to your java IDE