Java Code Examples for java.lang.management.ThreadMXBean#setThreadContentionMonitoringEnabled()
The following examples show how to use
java.lang.management.ThreadMXBean#setThreadContentionMonitoringEnabled() .
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: JvmThreadingImpl.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
/** * Setter for the "JvmThreadContentionMonitoring" variable. */ public void setJvmThreadContentionMonitoring( EnumJvmThreadContentionMonitoring x) throws SnmpStatusException { ThreadMXBean mbean = getThreadMXBean(); // We can trust the received value, it has been checked in // checkJvmThreadContentionMonitoring if(JvmThreadContentionMonitoringEnabled.intValue() == x.intValue()) mbean.setThreadContentionMonitoringEnabled(true); else mbean.setThreadContentionMonitoringEnabled(false); }
Example 2
Source File: JvmThreadingImpl.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * Setter for the "JvmThreadContentionMonitoring" variable. */ public void setJvmThreadContentionMonitoring( EnumJvmThreadContentionMonitoring x) throws SnmpStatusException { ThreadMXBean mbean = getThreadMXBean(); // We can trust the received value, it has been checked in // checkJvmThreadContentionMonitoring if(JvmThreadContentionMonitoringEnabled.intValue() == x.intValue()) mbean.setThreadContentionMonitoringEnabled(true); else mbean.setThreadContentionMonitoringEnabled(false); }
Example 3
Source File: JvmThreadingImpl.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * Setter for the "JvmThreadContentionMonitoring" variable. */ public void setJvmThreadContentionMonitoring( EnumJvmThreadContentionMonitoring x) throws SnmpStatusException { ThreadMXBean mbean = getThreadMXBean(); // We can trust the received value, it has been checked in // checkJvmThreadContentionMonitoring if(JvmThreadContentionMonitoringEnabled.intValue() == x.intValue()) mbean.setThreadContentionMonitoringEnabled(true); else mbean.setThreadContentionMonitoringEnabled(false); }
Example 4
Source File: JvmThreadingImpl.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * Setter for the "JvmThreadContentionMonitoring" variable. */ public void setJvmThreadContentionMonitoring( EnumJvmThreadContentionMonitoring x) throws SnmpStatusException { ThreadMXBean mbean = getThreadMXBean(); // We can trust the received value, it has been checked in // checkJvmThreadContentionMonitoring if(JvmThreadContentionMonitoringEnabled.intValue() == x.intValue()) mbean.setThreadContentionMonitoringEnabled(true); else mbean.setThreadContentionMonitoringEnabled(false); }
Example 5
Source File: JvmThreadingImpl.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * Setter for the "JvmThreadContentionMonitoring" variable. */ public void setJvmThreadContentionMonitoring( EnumJvmThreadContentionMonitoring x) throws SnmpStatusException { ThreadMXBean mbean = getThreadMXBean(); // We can trust the received value, it has been checked in // checkJvmThreadContentionMonitoring if(JvmThreadContentionMonitoringEnabled.intValue() == x.intValue()) mbean.setThreadContentionMonitoringEnabled(true); else mbean.setThreadContentionMonitoringEnabled(false); }
Example 6
Source File: JvmThreadingImpl.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * Setter for the "JvmThreadContentionMonitoring" variable. */ public void setJvmThreadContentionMonitoring( EnumJvmThreadContentionMonitoring x) throws SnmpStatusException { ThreadMXBean mbean = getThreadMXBean(); // We can trust the received value, it has been checked in // checkJvmThreadContentionMonitoring if(JvmThreadContentionMonitoringEnabled.intValue() == x.intValue()) mbean.setThreadContentionMonitoringEnabled(true); else mbean.setThreadContentionMonitoringEnabled(false); }
Example 7
Source File: JvmThreadingImpl.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * Setter for the "JvmThreadContentionMonitoring" variable. */ public void setJvmThreadContentionMonitoring( EnumJvmThreadContentionMonitoring x) throws SnmpStatusException { ThreadMXBean mbean = getThreadMXBean(); // We can trust the received value, it has been checked in // checkJvmThreadContentionMonitoring if(JvmThreadContentionMonitoringEnabled.intValue() == x.intValue()) mbean.setThreadContentionMonitoringEnabled(true); else mbean.setThreadContentionMonitoringEnabled(false); }
Example 8
Source File: JvmThreadingImpl.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * Setter for the "JvmThreadContentionMonitoring" variable. */ public void setJvmThreadContentionMonitoring( EnumJvmThreadContentionMonitoring x) throws SnmpStatusException { ThreadMXBean mbean = getThreadMXBean(); // We can trust the received value, it has been checked in // checkJvmThreadContentionMonitoring if(JvmThreadContentionMonitoringEnabled.intValue() == x.intValue()) mbean.setThreadContentionMonitoringEnabled(true); else mbean.setThreadContentionMonitoringEnabled(false); }
Example 9
Source File: JvmThreadingImpl.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * Setter for the "JvmThreadContentionMonitoring" variable. */ public void setJvmThreadContentionMonitoring( EnumJvmThreadContentionMonitoring x) throws SnmpStatusException { ThreadMXBean mbean = getThreadMXBean(); // We can trust the received value, it has been checked in // checkJvmThreadContentionMonitoring if(JvmThreadContentionMonitoringEnabled.intValue() == x.intValue()) mbean.setThreadContentionMonitoringEnabled(true); else mbean.setThreadContentionMonitoringEnabled(false); }
Example 10
Source File: JvmThreadingImpl.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
/** * Setter for the "JvmThreadContentionMonitoring" variable. */ public void setJvmThreadContentionMonitoring( EnumJvmThreadContentionMonitoring x) throws SnmpStatusException { ThreadMXBean mbean = getThreadMXBean(); // We can trust the received value, it has been checked in // checkJvmThreadContentionMonitoring if(JvmThreadContentionMonitoringEnabled.intValue() == x.intValue()) mbean.setThreadContentionMonitoringEnabled(true); else mbean.setThreadContentionMonitoringEnabled(false); }
Example 11
Source File: MultiThreadedSpecTest.java From tlaplus with MIT License | 5 votes |
@Before public void setUp() { // Set the threshold before TLC (periodically) checks liveness to // the largest possible value. This essentially stops TLC from checking // liveness during model checking and delays it until the end when one // final liveness check is run. We only then get deterministic behavior // needed by this test to e.g. check the number of states generated... TLCGlobals.livenessThreshold = Double.MAX_VALUE; final ThreadMXBean threadBean = ManagementFactory.getThreadMXBean(); // Enable contention thread statistics to have the JVM measure // BlockedTime and WaitedTime. threadBean.setThreadContentionMonitoringEnabled(true); // Register a listener hot for the termination of the TLC worker // threads. // Using ThreadMXBean directly to lookup all threads after TLC has // finished has the potential that the JVM deletes the worker threads // before this test gets a chance to collect statistics. WorkerMonitor.addThreadListener(new WorkerMonitor.ThreadListener() { public synchronized void terminated(final Thread thread, final long runningTime) { final ThreadInfo threadInfo = threadBean.getThreadInfo(thread.getId()); double d = threadInfo.getBlockedTime() / (runningTime * 1.0d); double d2 = threadInfo.getWaitedTime() / (runningTime * 1.0d); performanceResults.add(new PerformanceResult(thread.getName(), d, d2)); latch.countDown(); } }); }
Example 12
Source File: JvmThreadingImpl.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * Setter for the "JvmThreadContentionMonitoring" variable. */ public void setJvmThreadContentionMonitoring( EnumJvmThreadContentionMonitoring x) throws SnmpStatusException { ThreadMXBean mbean = getThreadMXBean(); // We can trust the received value, it has been checked in // checkJvmThreadContentionMonitoring if(JvmThreadContentionMonitoringEnabled.intValue() == x.intValue()) mbean.setThreadContentionMonitoringEnabled(true); else mbean.setThreadContentionMonitoringEnabled(false); }
Example 13
Source File: JvmThreadingImpl.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
/** * Setter for the "JvmThreadContentionMonitoring" variable. */ public void setJvmThreadContentionMonitoring( EnumJvmThreadContentionMonitoring x) throws SnmpStatusException { ThreadMXBean mbean = getThreadMXBean(); // We can trust the received value, it has been checked in // checkJvmThreadContentionMonitoring if(JvmThreadContentionMonitoringEnabled.intValue() == x.intValue()) mbean.setThreadContentionMonitoringEnabled(true); else mbean.setThreadContentionMonitoringEnabled(false); }
Example 14
Source File: TrackingLogger.java From TNT4J with Apache License 2.0 | 5 votes |
/** * Check and enable java timing for use by activities * */ private static void initJavaTiming() { ThreadMXBean tmbean = ManagementFactory.getThreadMXBean(); boolean cpuTimingSupported = tmbean.isCurrentThreadCpuTimeSupported(); if (cpuTimingSupported) { tmbean.setThreadCpuTimeEnabled(cpuTimingSupported); } boolean contTimingSupported = tmbean.isThreadContentionMonitoringSupported(); if (contTimingSupported) { tmbean.setThreadContentionMonitoringEnabled(contTimingSupported); } }
Example 15
Source File: ResourceMonitoring.java From gocd with Apache License 2.0 | 5 votes |
public void enableIfDiagnosticsModeIsEnabled() { if (systemEnvironment.get(SystemEnvironment.GO_DIAGNOSTICS_MODE)) { ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean(); if (threadMXBean.isThreadContentionMonitoringSupported()) { threadMXBean.setThreadContentionMonitoringEnabled(true); } if (threadMXBean.isThreadCpuTimeSupported()) { threadMXBean.setThreadCpuTimeEnabled(true); } if (isThreadAllocatedMemorySupported(threadMXBean)) { setThreadAllocatedMemoryEnabled(threadMXBean); } } }
Example 16
Source File: ThreadDumperTest.java From cougar with Apache License 2.0 | 5 votes |
public void testThreadContentionMonitoring() { ThreadMXBean mx = ManagementFactory.getThreadMXBean(); mx.setThreadContentionMonitoringEnabled(false); Map<String, String> params = new HashMap<String, String>(); params.put("command", "toggleCM"); String value = new ThreadDumper().process(params); assertTrue(value.contains("Contention monitoring enabled: true")); value = new ThreadDumper().process(params); assertTrue(value.contains("Contention monitoring enabled: false")); }