Skip to content

Instantly share code, notes, and snippets.

View royling's full-sized avatar
🔬
Keep practicing and learning everyday!

Roy Ling royling

🔬
Keep practicing and learning everyday!
View GitHub Profile
/*
* Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@royling
royling / FuturesB.java
Created January 13, 2016 04:39 — forked from benjchristensen/FuturesB.java
FuturesB.java Example of using Futures for nested calls showing how it blocks inefficiently.
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;