Created
January 30, 2013 05:54
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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