< prev index next >

test/java/lang/management/ThreadMXBean/SynchronizationStatistics.java

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


   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 /*
  25  * @test
  26  * @bug     4530538
  27  * @summary Basic unit test of the synchronization statistics support:
  28  *
  29  * @author  Mandy Chung
  30  * @author  Jaroslav Bachorik
  31  *
  32  * @modules java.management
  33  * @run main/othervm SynchronizationStatistics
  34  */
  35 
  36 import java.lang.management.*;
  37 import java.util.concurrent.Phaser;
  38 import java.util.function.Supplier;
  39 
  40 public class SynchronizationStatistics {
  41     private static class LockerThread extends Thread {
  42         public LockerThread(Runnable r) {
  43             super(r, "LockerThread");
  44         }
  45     }
  46 
  47     private static final ThreadMXBean mbean = ManagementFactory.getThreadMXBean();
  48 
  49     private static final boolean blockedTimeCheck =
  50         mbean.isThreadContentionMonitoringSupported();
  51 
  52 




   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 /*
  25  * @test
  26  * @bug     4530538
  27  * @summary Basic unit test of the synchronization statistics support:

  28  * @author  Mandy Chung
  29  * @author  Jaroslav Bachorik
  30  *

  31  * @run main/othervm SynchronizationStatistics
  32  */
  33 
  34 import java.lang.management.*;
  35 import java.util.concurrent.Phaser;
  36 import java.util.function.Supplier;
  37 
  38 public class SynchronizationStatistics {
  39     private static class LockerThread extends Thread {
  40         public LockerThread(Runnable r) {
  41             super(r, "LockerThread");
  42         }
  43     }
  44 
  45     private static final ThreadMXBean mbean = ManagementFactory.getThreadMXBean();
  46 
  47     private static final boolean blockedTimeCheck =
  48         mbean.isThreadContentionMonitoringSupported();
  49 
  50 


< prev index next >