36N/A/*
2362N/A * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
36N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
36N/A *
36N/A * This code is free software; you can redistribute it and/or modify it
36N/A * under the terms of the GNU General Public License version 2 only, as
36N/A * published by the Free Software Foundation.
36N/A *
36N/A * This code is distributed in the hope that it will be useful, but WITHOUT
36N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
36N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
36N/A * version 2 for more details (a copy is included in the LICENSE file that
36N/A * accompanied this code).
36N/A *
36N/A * You should have received a copy of the GNU General Public License version
36N/A * 2 along with this work; if not, write to the Free Software Foundation,
36N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
36N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
36N/A */
36N/A
36N/Aimport java.util.concurrent.*;
36N/A
36N/A/**
36N/A * This is not a regression test, but a stress benchmark test for
36N/A * 6602600: Fast removal of cancelled scheduled thread pool tasks
36N/A *
36N/A * This runs in the same wall clock time, but much reduced cpu time,
36N/A * with the changes for 6602600.
36N/A */
36N/Apublic class Stress {
36N/A
36N/A public static void main(String[] args) throws Throwable {
36N/A
36N/A final CountDownLatch count = new CountDownLatch(1000);
36N/A
36N/A final ScheduledThreadPoolExecutor pool =
36N/A new ScheduledThreadPoolExecutor(100);
36N/A pool.prestartAllCoreThreads();
36N/A
36N/A final Runnable incTask = new Runnable() { public void run() {
36N/A count.countDown();
36N/A }};
36N/A
36N/A pool.scheduleAtFixedRate(incTask, 0, 10, TimeUnit.MILLISECONDS);
36N/A
36N/A count.await();
36N/A
36N/A pool.shutdown();
36N/A pool.awaitTermination(1L, TimeUnit.DAYS);
36N/A }
36N/A}