< prev index next >

test/java/lang/management/ManagementFactory/GetObjectName.java

Print this page
rev 11832 : 8078896: Add @modules as needed to the jdk_svc tests
Reviewed-by: alanb, mchung
   1 /*
   2  * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   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 /* @test
  25  * @bug 7068328
  26  * @summary Test if getObjectName handles properly when called by
  27  *          multiple threads simultaneously. Run in othervm mode to
  28  *          make sure the object name is not initialized to begin with.

  29  * @run main/othervm GetObjectName
  30  */
  31 
  32 import java.lang.management.BufferPoolMXBean;
  33 import java.lang.management.ManagementFactory;
  34 import java.lang.management.PlatformLoggingMXBean;
  35 import java.lang.management.PlatformManagedObject;
  36 import java.util.ArrayList;
  37 import java.util.List;
  38 import java.util.concurrent.ExecutorService;
  39 import java.util.concurrent.Executors;
  40 import java.util.concurrent.LinkedBlockingQueue;
  41 import java.util.concurrent.TimeUnit;
  42 
  43 public class GetObjectName {
  44     private static boolean failed = false;
  45     public static void main(String[] args) throws Exception {
  46         int tasks = 10000;
  47         ExecutorService executor = Executors.newFixedThreadPool(10);
  48         submitTasks(executor, tasks);


   1 /*
   2  * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   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 /* @test
  25  * @bug 7068328
  26  * @summary Test if getObjectName handles properly when called by
  27  *          multiple threads simultaneously. Run in othervm mode to
  28  *          make sure the object name is not initialized to begin with.
  29  * @modules java.management
  30  * @run main/othervm GetObjectName
  31  */
  32 
  33 import java.lang.management.BufferPoolMXBean;
  34 import java.lang.management.ManagementFactory;
  35 import java.lang.management.PlatformLoggingMXBean;
  36 import java.lang.management.PlatformManagedObject;
  37 import java.util.ArrayList;
  38 import java.util.List;
  39 import java.util.concurrent.ExecutorService;
  40 import java.util.concurrent.Executors;
  41 import java.util.concurrent.LinkedBlockingQueue;
  42 import java.util.concurrent.TimeUnit;
  43 
  44 public class GetObjectName {
  45     private static boolean failed = false;
  46     public static void main(String[] args) throws Exception {
  47         int tasks = 10000;
  48         ExecutorService executor = Executors.newFixedThreadPool(10);
  49         submitTasks(executor, tasks);


< prev index next >