< prev index next >

test/jdk/java/util/concurrent/FutureTask/BlockingTaskExecutor.java

Print this page
rev 51731 : imported patch 8210732


   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /*
  25  * @test
  26  * @bug 6431315
  27  * @summary ExecutorService.invokeAll might hang
  28  * @author Martin Buchholz
  29  * @library /lib/testlibrary/
  30  */
  31 
  32 import static java.util.concurrent.TimeUnit.MILLISECONDS;
  33 
  34 import java.util.ArrayList;
  35 import java.util.Collection;
  36 import java.util.concurrent.Callable;
  37 import java.util.concurrent.ExecutorService;
  38 import java.util.concurrent.Executors;
  39 import java.util.concurrent.RejectedExecutionException;
  40 import jdk.testlibrary.Utils;
  41 
  42 /**
  43  * Adapted from Doug Lea, which was...
  44  * adapted from a posting by Tom Sugden tom at epcc.ed.ac.uk
  45  */
  46 public class BlockingTaskExecutor {
  47     static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);
  48 
  49     static void realMain(String[] args) throws Throwable {
  50         for (int i = 1; i <= 100; i++) {
  51             System.out.print(".");
  52             test();
  53         }
  54     }
  55 
  56     static void test() throws Throwable {
  57         final ExecutorService executor = Executors.newCachedThreadPool();
  58 
  59         final NotificationReceiver notifiee1 = new NotificationReceiver();
  60         final NotificationReceiver notifiee2 = new NotificationReceiver();




   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /*
  25  * @test
  26  * @bug 6431315
  27  * @summary ExecutorService.invokeAll might hang
  28  * @author Martin Buchholz
  29  * @library /test/lib
  30  */
  31 
  32 import static java.util.concurrent.TimeUnit.MILLISECONDS;
  33 
  34 import java.util.ArrayList;
  35 import java.util.Collection;
  36 import java.util.concurrent.Callable;
  37 import java.util.concurrent.ExecutorService;
  38 import java.util.concurrent.Executors;
  39 import java.util.concurrent.RejectedExecutionException;
  40 import jdk.test.lib.Utils;
  41 
  42 /**
  43  * Adapted from Doug Lea, which was...
  44  * adapted from a posting by Tom Sugden tom at epcc.ed.ac.uk
  45  */
  46 public class BlockingTaskExecutor {
  47     static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);
  48 
  49     static void realMain(String[] args) throws Throwable {
  50         for (int i = 1; i <= 100; i++) {
  51             System.out.print(".");
  52             test();
  53         }
  54     }
  55 
  56     static void test() throws Throwable {
  57         final ExecutorService executor = Executors.newCachedThreadPool();
  58 
  59         final NotificationReceiver notifiee1 = new NotificationReceiver();
  60         final NotificationReceiver notifiee2 = new NotificationReceiver();


< prev index next >