ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/loops/ConcurrentQueueLoops.java
(Generate patch)

Comparing jsr166/src/test/loops/ConcurrentQueueLoops.java (file contents):
Revision 1.15 by jsr166, Thu Dec 18 18:13:06 2014 UTC vs.
Revision 1.19 by jsr166, Sat Dec 31 19:02:43 2016 UTC

# Line 4 | Line 4
4   * http://creativecommons.org/publicdomain/zero/1.0/
5   */
6  
7 < import java.util.*;
8 < import java.util.concurrent.*;
9 < import java.util.concurrent.locks.*;
10 < import java.util.concurrent.atomic.*;
7 > import java.util.ArrayList;
8 > import java.util.Queue;
9 > import java.util.concurrent.Callable;
10 > import java.util.concurrent.CyclicBarrier;
11 > import java.util.concurrent.ExecutorService;
12 > import java.util.concurrent.Executors;
13 > import java.util.concurrent.Future;
14  
15   public class ConcurrentQueueLoops {
16      static final ExecutorService pool = Executors.newCachedThreadPool();
# Line 21 | Line 24 | public class ConcurrentQueueLoops {
24      public static void main(String[] args) throws Exception {
25          int maxStages = 100;
26          int work = 1024;
27 <        Class klass = null;
27 >        Class<?> klass = null;
28          if (args.length > 0) {
29              try {
30                  klass = Class.forName(args[0]);
# Line 116 | Line 119 | public class ConcurrentQueueLoops {
119          }
120      }
121  
122 <    static void oneRun(Class klass, int n) throws Exception {
123 <        Queue<Integer> q = (Queue<Integer>) klass.newInstance();
122 >    static void oneRun(Class<?> klass, int n) throws Exception {
123 >        Queue<Integer> q =
124 >            (Queue<Integer>) klass.getConstructor().newInstance();
125          LoopHelpers.BarrierTimer timer = new LoopHelpers.BarrierTimer();
126          CyclicBarrier barrier = new CyclicBarrier(n + 1, timer);
127          ArrayList<Future<Integer>> results = new ArrayList<Future<Integer>>(n);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines