Java Code Examples for java.lang.management.ThreadMXBean#isSynchronizerUsageSupported()
The following examples show how to use
java.lang.management.ThreadMXBean#isSynchronizerUsageSupported() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SharedSynchronizer.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws Exception { MyThread t = new MyThread(); t.setDaemon(true); t.start(); ThreadMXBean tmbean = ManagementFactory.getThreadMXBean(); if (!tmbean.isSynchronizerUsageSupported()) { System.out.println("Monitoring of synchronizer usage not supported") ; return; } long[] result = tmbean.findDeadlockedThreads(); if (result != null) { throw new RuntimeException("TEST FAILED: result should be null"); } }
Example 2
Source File: SharedSynchronizer.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws Exception { MyThread t = new MyThread(); t.setDaemon(true); t.start(); ThreadMXBean tmbean = ManagementFactory.getThreadMXBean(); if (!tmbean.isSynchronizerUsageSupported()) { System.out.println("Monitoring of synchronizer usage not supported") ; return; } long[] result = tmbean.findDeadlockedThreads(); if (result != null) { throw new RuntimeException("TEST FAILED: result should be null"); } }
Example 3
Source File: SharedSynchronizer.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws Exception { MyThread t = new MyThread(); t.setDaemon(true); t.start(); ThreadMXBean tmbean = ManagementFactory.getThreadMXBean(); if (!tmbean.isSynchronizerUsageSupported()) { System.out.println("Monitoring of synchronizer usage not supported") ; return; } long[] result = tmbean.findDeadlockedThreads(); if (result != null) { throw new RuntimeException("TEST FAILED: result should be null"); } }
Example 4
Source File: SharedSynchronizer.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws Exception { MyThread t = new MyThread(); t.setDaemon(true); t.start(); ThreadMXBean tmbean = ManagementFactory.getThreadMXBean(); if (!tmbean.isSynchronizerUsageSupported()) { System.out.println("Monitoring of synchronizer usage not supported") ; return; } long[] result = tmbean.findDeadlockedThreads(); if (result != null) { throw new RuntimeException("TEST FAILED: result should be null"); } }
Example 5
Source File: SharedSynchronizer.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws Exception { MyThread t = new MyThread(); t.setDaemon(true); t.start(); ThreadMXBean tmbean = ManagementFactory.getThreadMXBean(); if (!tmbean.isSynchronizerUsageSupported()) { System.out.println("Monitoring of synchronizer usage not supported") ; return; } long[] result = tmbean.findDeadlockedThreads(); if (result != null) { throw new RuntimeException("TEST FAILED: result should be null"); } }
Example 6
Source File: SharedSynchronizer.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws Exception { MyThread t = new MyThread(); t.setDaemon(true); t.start(); ThreadMXBean tmbean = ManagementFactory.getThreadMXBean(); if (!tmbean.isSynchronizerUsageSupported()) { System.out.println("Monitoring of synchronizer usage not supported") ; return; } long[] result = tmbean.findDeadlockedThreads(); if (result != null) { throw new RuntimeException("TEST FAILED: result should be null"); } }
Example 7
Source File: SharedSynchronizer.java From hottub with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws Exception { MyThread t = new MyThread(); t.setDaemon(true); t.start(); ThreadMXBean tmbean = ManagementFactory.getThreadMXBean(); if (!tmbean.isSynchronizerUsageSupported()) { System.out.println("Monitoring of synchronizer usage not supported") ; return; } long[] result = tmbean.findDeadlockedThreads(); if (result != null) { throw new RuntimeException("TEST FAILED: result should be null"); } }
Example 8
Source File: SharedSynchronizer.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws Exception { MyThread t = new MyThread(); t.setDaemon(true); t.start(); ThreadMXBean tmbean = ManagementFactory.getThreadMXBean(); if (!tmbean.isSynchronizerUsageSupported()) { System.out.println("Monitoring of synchronizer usage not supported") ; return; } long[] result = tmbean.findDeadlockedThreads(); if (result != null) { throw new RuntimeException("TEST FAILED: result should be null"); } }
Example 9
Source File: SharedSynchronizer.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws Exception { MyThread t = new MyThread(); t.setDaemon(true); t.start(); ThreadMXBean tmbean = ManagementFactory.getThreadMXBean(); if (!tmbean.isSynchronizerUsageSupported()) { System.out.println("Monitoring of synchronizer usage not supported") ; return; } long[] result = tmbean.findDeadlockedThreads(); if (result != null) { throw new RuntimeException("TEST FAILED: result should be null"); } }
Example 10
Source File: SharedSynchronizer.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws Exception { MyThread t = new MyThread(); t.setDaemon(true); t.start(); ThreadMXBean tmbean = ManagementFactory.getThreadMXBean(); if (!tmbean.isSynchronizerUsageSupported()) { System.out.println("Monitoring of synchronizer usage not supported") ; return; } long[] result = tmbean.findDeadlockedThreads(); if (result != null) { throw new RuntimeException("TEST FAILED: result should be null"); } }
Example 11
Source File: SharedSynchronizer.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws Exception { MyThread t = new MyThread(); t.setDaemon(true); t.start(); ThreadMXBean tmbean = ManagementFactory.getThreadMXBean(); if (!tmbean.isSynchronizerUsageSupported()) { System.out.println("Monitoring of synchronizer usage not supported") ; return; } long[] result = tmbean.findDeadlockedThreads(); if (result != null) { throw new RuntimeException("TEST FAILED: result should be null"); } }
Example 12
Source File: SharedSynchronizer.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws Exception { MyThread t = new MyThread(); t.setDaemon(true); t.start(); ThreadMXBean tmbean = ManagementFactory.getThreadMXBean(); if (!tmbean.isSynchronizerUsageSupported()) { System.out.println("Monitoring of synchronizer usage not supported") ; return; } long[] result = tmbean.findDeadlockedThreads(); if (result != null) { throw new RuntimeException("TEST FAILED: result should be null"); } }
Example 13
Source File: SharedSynchronizer.java From native-obfuscator with GNU General Public License v3.0 | 6 votes |
public static void main(String[] args) throws Exception { MyThread t = new MyThread(); t.setDaemon(true); t.start(); ThreadMXBean tmbean = ManagementFactory.getThreadMXBean(); if (!tmbean.isSynchronizerUsageSupported()) { System.out.println("Monitoring of synchronizer usage not supported") ; return; } long[] result = tmbean.findDeadlockedThreads(); if (result != null) { throw new RuntimeException("TEST FAILED: result should be null"); } }
Example 14
Source File: SharedSynchronizer.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
public static void main(String[] args) throws Exception { MyThread t = new MyThread(); t.setDaemon(true); t.start(); ThreadMXBean tmbean = ManagementFactory.getThreadMXBean(); if (!tmbean.isSynchronizerUsageSupported()) { System.out.println("Monitoring of synchronizer usage not supported") ; return; } long[] result = tmbean.findDeadlockedThreads(); if (result != null) { throw new RuntimeException("TEST FAILED: result should be null"); } }
Example 15
Source File: ProxyClient.java From jmxmon with Apache License 2.0 | 5 votes |
public long[] findDeadlockedThreads() throws IOException { ThreadMXBean tm = getThreadMXBean(); if (supportsLockUsage && tm.isSynchronizerUsageSupported()) { return tm.findDeadlockedThreads(); } else { return tm.findMonitorDeadlockedThreads(); } }
Example 16
Source File: ProxyClient.java From jvmtop with GNU General Public License v2.0 | 5 votes |
public long[] findDeadlockedThreads() throws IOException { ThreadMXBean tm = getThreadMXBean(); if (supportsLockUsage && tm.isSynchronizerUsageSupported()) { return tm.findDeadlockedThreads(); } else { return tm.findMonitorDeadlockedThreads(); } }
Example 17
Source File: JavaInformations.java From javamelody with Apache License 2.0 | 5 votes |
private static long[] getDeadlockedThreads(ThreadMXBean threadBean) { final long[] deadlockedThreads; if (threadBean.isSynchronizerUsageSupported()) { deadlockedThreads = threadBean.findDeadlockedThreads(); } else { deadlockedThreads = threadBean.findMonitorDeadlockedThreads(); } if (deadlockedThreads != null) { Arrays.sort(deadlockedThreads); } return deadlockedThreads; }
Example 18
Source File: JmxSupport.java From visualvm with GNU General Public License v2.0 | 4 votes |
private void print16Thread(final StringBuilder sb, final ThreadMXBean threadMXBean, final ThreadInfo thread) { MonitorInfo[] monitors = null; if (threadMXBean.isObjectMonitorUsageSupported()) { monitors = thread.getLockedMonitors(); } sb.append("\n\"" + thread.getThreadName() + // NOI18N "\" - Thread t@" + thread.getThreadId() + "\n"); // NOI18N sb.append(" java.lang.Thread.State: " + thread.getThreadState()); // NOI18N sb.append("\n"); // NOI18N int index = 0; for (StackTraceElement st : thread.getStackTrace()) { LockInfo lock = thread.getLockInfo(); String lockOwner = thread.getLockOwnerName(); sb.append("\tat " + st.toString() + "\n"); // NOI18N if (index == 0) { if ("java.lang.Object".equals(st.getClassName()) && // NOI18N "wait".equals(st.getMethodName())) { // NOI18N if (lock != null) { sb.append("\t- waiting on "); // NOI18N printLock(sb,lock); sb.append("\n"); // NOI18N } } else if (lock != null) { if (lockOwner == null) { sb.append("\t- parking to wait for "); // NOI18N printLock(sb,lock); sb.append("\n"); // NOI18N } else { sb.append("\t- waiting to lock "); // NOI18N printLock(sb,lock); sb.append(" owned by \""+lockOwner+"\" t@"+thread.getLockOwnerId()+"\n"); // NOI18N } } } printMonitors(sb, monitors, index); index++; } StringBuilder jnisb = new StringBuilder(); printMonitors(jnisb, monitors, -1); if (jnisb.length() > 0) { sb.append(" JNI locked monitors:\n"); sb.append(jnisb); } if (threadMXBean.isSynchronizerUsageSupported()) { sb.append("\n Locked ownable synchronizers:"); // NOI18N LockInfo[] synchronizers = thread.getLockedSynchronizers(); if (synchronizers == null || synchronizers.length == 0) { sb.append("\n\t- None\n"); // NOI18N } else { for (LockInfo li : synchronizers) { sb.append("\n\t- locked "); // NOI18N printLock(sb,li); sb.append("\n"); // NOI18N } } } }