< prev index next >

test/java/lang/management/ThreadMXBean/ThreadDaemonTest.java

Print this page
rev 16783 : 8176176: fix @modules in jdk_svc tests
Reviewed-by: duke


  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 import java.lang.management.*;
  25 import java.util.*;
  26 import java.util.concurrent.*;
  27 import java.util.concurrent.atomic.*;
  28 
  29 /*
  30  * @test
  31  * @bug     6588467
  32  * @summary Basic test of ThreadInfo.isDaemon
  33  * @author  Jeremy Manson
  34  * @modules java.management
  35  */
  36 public class ThreadDaemonTest {
  37 
  38     public static void main(String[] args) throws Exception {
  39         final int NUM_THREADS = 20;
  40         final String THREAD_PREFIX = "ThreadDaemonTest-";
  41 
  42         final CountDownLatch started = new CountDownLatch(NUM_THREADS);
  43         final CountDownLatch finished = new CountDownLatch(1);
  44         final AtomicReference<Exception> fail = new AtomicReference<>(null);
  45 
  46         Thread[] allThreads = new Thread[NUM_THREADS];
  47         ThreadMXBean mbean = ManagementFactory.getThreadMXBean();
  48         Random rand = new Random();
  49 
  50         for (int i = 0; i < NUM_THREADS; i++) {
  51             allThreads[i] = new Thread(new Runnable() {
  52                     public void run() {
  53                         try {
  54                             started.countDown();




  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 import java.lang.management.*;
  25 import java.util.*;
  26 import java.util.concurrent.*;
  27 import java.util.concurrent.atomic.*;
  28 
  29 /*
  30  * @test
  31  * @bug     6588467
  32  * @summary Basic test of ThreadInfo.isDaemon
  33  * @author  Jeremy Manson

  34  */
  35 public class ThreadDaemonTest {
  36 
  37     public static void main(String[] args) throws Exception {
  38         final int NUM_THREADS = 20;
  39         final String THREAD_PREFIX = "ThreadDaemonTest-";
  40 
  41         final CountDownLatch started = new CountDownLatch(NUM_THREADS);
  42         final CountDownLatch finished = new CountDownLatch(1);
  43         final AtomicReference<Exception> fail = new AtomicReference<>(null);
  44 
  45         Thread[] allThreads = new Thread[NUM_THREADS];
  46         ThreadMXBean mbean = ManagementFactory.getThreadMXBean();
  47         Random rand = new Random();
  48 
  49         for (int i = 0; i < NUM_THREADS; i++) {
  50             allThreads[i] = new Thread(new Runnable() {
  51                     public void run() {
  52                         try {
  53                             started.countDown();


< prev index next >