< prev index next >

test/java/lang/management/ThreadMXBean/SharedSynchronizer.java

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


  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     6337571
  27  * @summary Test if findDeadlockedThreads works for an ownable synchronizer
  28  *          in shared mode which has no owner when a thread is parked.
  29  * @author  Mandy Chung
  30  *
  31  * @modules java.management
  32  * @run main/othervm SharedSynchronizer
  33  */
  34 
  35 
  36 import java.util.concurrent.*;
  37 import java.lang.management.ManagementFactory;
  38 import java.lang.management.ThreadMXBean;
  39 
  40 public class SharedSynchronizer {
  41     public static void main(String[] args) throws Exception {
  42         MyThread t = new MyThread();
  43         t.setDaemon(true);
  44         t.start();
  45 
  46         ThreadMXBean tmbean = ManagementFactory.getThreadMXBean();
  47         if (!tmbean.isSynchronizerUsageSupported()) {
  48             System.out.println("Monitoring of synchronizer usage not supported")
  49 ;
  50             return;
  51         }




  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     6337571
  27  * @summary Test if findDeadlockedThreads works for an ownable synchronizer
  28  *          in shared mode which has no owner when a thread is parked.
  29  * @author  Mandy Chung
  30  *

  31  * @run main/othervm SharedSynchronizer
  32  */
  33 
  34 
  35 import java.util.concurrent.*;
  36 import java.lang.management.ManagementFactory;
  37 import java.lang.management.ThreadMXBean;
  38 
  39 public class SharedSynchronizer {
  40     public static void main(String[] args) throws Exception {
  41         MyThread t = new MyThread();
  42         t.setDaemon(true);
  43         t.start();
  44 
  45         ThreadMXBean tmbean = ManagementFactory.getThreadMXBean();
  46         if (!tmbean.isSynchronizerUsageSupported()) {
  47             System.out.println("Monitoring of synchronizer usage not supported")
  48 ;
  49             return;
  50         }


< prev index next >