Here you can find the source of submitAndWait(ListeningExecutorService service, Callable
public static <T> T submitAndWait(ListeningExecutorService service, Callable<T> ca) throws InterruptedException, ExecutionException
//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*/ }