Java Thread Callable submitAndWait(ListeningExecutorService service, Callable ca)

Here you can find the source of submitAndWait(ListeningExecutorService service, Callable ca)

Description

submit And Wait

License

Apache License

Declaration

public static <T> T submitAndWait(ListeningExecutorService service, Callable<T> ca)
            throws InterruptedException, ExecutionException 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;

import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService;

public class Main {
    public static <T> T submitAndWait(ListeningExecutorService service, Callable<T> ca)
            throws InterruptedException, ExecutionException {
        ListenableFuture<T> lf = service.submit(ca);
        return lf.get();
    }/*from www . j a v a  2 s. c o m*/
}

Related

  1. runConcurrently(final Callable task, final int times)
  2. runInBackground(final Callable callable)
  3. runTest(Callable test)
  4. runWithTimeout(long millisTimeout, Callable callable)
  5. shuffleRow(final double[] data)
  6. submitManyAndWait(ListeningExecutorService service, Iterable> cas, FutureCallback fca)
  7. sum(final double[] a)
  8. sumOfSquares(final double[] data)
  9. waitFor(final Process process, final CyclicBarrier onStart)