@@ -0,0 +1,1255 @@
+import java.security.*;%0D%0Aimport java.util.concurrent.*;%0D%0A%0D%0Apublic class NoContention %7B%0D%0A    static public void main(String args%5B%5D) %7B%0D%0A        int nTasks = Integer.parseInt(args%5B0%5D);%0D%0A        int nThreads = Integer.parseInt(args%5B1%5D);%0D%0A        ConcurrentHashMap%3CPublicKey, PrivateKey%3E map =%0D%0A            new ConcurrentHashMap%3CPublicKey, PrivateKey%3E();%0D%0A%0D%0A        Runnable task = () -%3E %7B%0D%0A            try %7B%0D%0A                KeyPairGenerator keyGen = KeyPairGenerator.getInstance(%22DSA%22, %22SUN%22);%0D%0A%0D%0A                SecureRandom random = SecureRandom.getInstanceStrong();%0D%0A                keyGen.initialize(2048, random);%0D%0A                KeyPair pair = keyGen.generateKeyPair();%0D%0A                map.put(pair.getPublic(), pair.getPrivate());%0D%0A            %7D catch (Exception e) %7B%0D%0A              System.out.println(%22Generation failed: %22 + e);%0D%0A            %7D%0D%0A        %7D;%0D%0A%0D%0A        ExecutorService executor = Executors.newFixedThreadPool(nThreads);%0D%0A        for (int i = 0; i %3C nTasks; i++)%0D%0A            executor.submit(task);%0D%0A        try %7B%0D%0A            executor.shutdown();%0D%0A            executor.awaitTermination(5, TimeUnit.SECONDS);%0D%0A        %7D catch (InterruptedException e) %7B%0D%0A            System.err.println(%22Interrupted await: %22 + e);%0D%0A        %7D%0D%0A    %7D%0D%0A%7D%0D%0A

Remove source of contention