O'Reilly logo

Java™ Performance by Binu John, Charlie Hunt

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Lock Contention Fifth Implementation

The fifth implementation partitions the taxpayer database into 50 HashMaps, one for each state, and also uses the ThreadLocal Random.

BailoutMain.java

/** * An example program to illustrate lock contention for Java Performancebook. */import java.text.DecimalFormat;import java.text.NumberFormat;import java.util.ArrayList;import java.util.HashSet;import java.util.List;import java.util.Random;import java.util.Set;import java.util.concurrent.Callable;import java.util.concurrent.ExecutionException;import java.util.concurrent.ExecutorService;import java.util.concurrent.Executors;import java.util.concurrent.Future;import java.util.logging.Level;import java.util.logging.Logger;public ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required