Skip to content

Instantly share code, notes, and snippets.

@benjchristensen
Created January 30, 2013 05:54
Show Gist options
  • Save benjchristensen/4671026 to your computer and use it in GitHub Desktop.
Save benjchristensen/4671026 to your computer and use it in GitHub Desktop.
Snippet of FuturesA.java (https://gist.github.com/4670979) Simple example of using Futures.
ExecutorService executor = new ThreadPoolExecutor(4, 4, 1, TimeUnit.MINUTES, new LinkedBlockingQueue<Runnable>());
Future<String> f1 = executor.submit(new CallToRemoteServiceA());
Future<String> f2 = executor.submit(new CallToRemoteServiceB());
System.out.println(f1.get() + " - " + f2.get());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment