Java Concurrency Practice. Original code is from Java 7 Concurrency Cookbook.