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 ...

Get Java™ Performance now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.