test/java/util/concurrent/ExecutorCompletionService/ExecutorCompletionServiceLoops.java

Print this page




  16  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  17  *
  18  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  19  * or visit www.oracle.com if you need additional information or have any
  20  * questions.
  21  */
  22 
  23 /*
  24  * This file is available under and governed by the GNU General Public
  25  * License version 2 only, as published by the Free Software Foundation.
  26  * However, the following notice accompanied the original version of this
  27  * file:
  28  *
  29  * Written by Doug Lea with assistance from members of JCP JSR-166
  30  * Expert Group and released to the public domain, as explained at
  31  * http://creativecommons.org/publicdomain/zero/1.0/
  32  */
  33 
  34 /*
  35  * @test
  36  * @bug 4965960
  37  * @compile -source 1.5 ExecutorCompletionServiceLoops.java
  38  * @run main/timeout=3600 ExecutorCompletionServiceLoops
  39  * @summary  Exercise ExecutorCompletionServiceLoops
  40  */
  41 
  42 import java.util.concurrent.*;
  43 
  44 public class ExecutorCompletionServiceLoops {
  45     static final int POOLSIZE =      100;
  46     static final ExecutorService pool =
  47         Executors.newFixedThreadPool(POOLSIZE);
  48     static final ExecutorCompletionService<Integer> ecs =
  49         new ExecutorCompletionService<Integer>(pool);
  50     static boolean print = false;
  51 
  52     public static void main(String[] args) throws Exception {
  53         int max = 8;
  54         int base = 10000;
  55 
  56         if (args.length > 0)
  57             max = Integer.parseInt(args[0]);




  16  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  17  *
  18  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  19  * or visit www.oracle.com if you need additional information or have any
  20  * questions.
  21  */
  22 
  23 /*
  24  * This file is available under and governed by the GNU General Public
  25  * License version 2 only, as published by the Free Software Foundation.
  26  * However, the following notice accompanied the original version of this
  27  * file:
  28  *
  29  * Written by Doug Lea with assistance from members of JCP JSR-166
  30  * Expert Group and released to the public domain, as explained at
  31  * http://creativecommons.org/publicdomain/zero/1.0/
  32  */
  33 
  34 /*
  35  * @test
  36  * @bug 4965960 8031651
  37  * @compile ExecutorCompletionServiceLoops.java
  38  * @run main/timeout=3600 ExecutorCompletionServiceLoops
  39  * @summary  Exercise ExecutorCompletionServiceLoops
  40  */
  41 
  42 import java.util.concurrent.*;
  43 
  44 public class ExecutorCompletionServiceLoops {
  45     static final int POOLSIZE =      100;
  46     static final ExecutorService pool =
  47         Executors.newFixedThreadPool(POOLSIZE);
  48     static final ExecutorCompletionService<Integer> ecs =
  49         new ExecutorCompletionService<Integer>(pool);
  50     static boolean print = false;
  51 
  52     public static void main(String[] args) throws Exception {
  53         int max = 8;
  54         int base = 10000;
  55 
  56         if (args.length > 0)
  57             max = Integer.parseInt(args[0]);