本文整理汇总了Java中java.lang.management.ThreadMXBean.isThreadContentionMonitoringSupported方法的典型用法代码示例。如果您正苦于以下问题:Java ThreadMXBean.isThreadContentionMonitoringSupported方法的具体用法?Java ThreadMXBean.isThreadContentionMonitoringSupported怎么用?Java ThreadMXBean.isThreadContentionMonitoringSupported使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.lang.management.ThreadMXBean
的用法示例。
在下文中一共展示了ThreadMXBean.isThreadContentionMonitoringSupported方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getJvmThreadContentionMonitoring
import java.lang.management.ThreadMXBean; //导入方法依赖的package包/类
/**
* Getter for the "JvmThreadContentionMonitoring" variable.
*/
public EnumJvmThreadContentionMonitoring getJvmThreadContentionMonitoring()
throws SnmpStatusException {
ThreadMXBean mbean = getThreadMXBean();
if(!mbean.isThreadContentionMonitoringSupported()) {
log.debug("getJvmThreadContentionMonitoring",
"Unsupported ThreadContentionMonitoring");
return JvmThreadContentionMonitoringUnsupported;
}
if(mbean.isThreadContentionMonitoringEnabled()) {
log.debug("getJvmThreadContentionMonitoring",
"Enabled ThreadContentionMonitoring");
return JvmThreadContentionMonitoringEnabled;
} else {
log.debug("getJvmThreadContentionMonitoring",
"Disabled ThreadContentionMonitoring");
return JvmThreadContentionMonitoringDisabled;
}
}
示例2: getJvmThreadInstBlockTimeMs
import java.lang.management.ThreadMXBean; //导入方法依赖的package包/类
/**
* Getter for the "JvmThreadInstBlockTimeMs" variable.
*/
public Long getJvmThreadInstBlockTimeMs() throws SnmpStatusException {
long l = 0;
final ThreadMXBean tmb = JvmThreadingImpl.getThreadMXBean();
if (tmb.isThreadContentionMonitoringSupported()) {
l = info.getBlockedTime();
//Monitoring is disabled
if(l == -1) l = 0;
}
return new Long(l);
}
示例3: getJvmThreadInstWaitTimeMs
import java.lang.management.ThreadMXBean; //导入方法依赖的package包/类
/**
* Getter for the "JvmThreadInstWaitTimeMs" variable.
*/
public Long getJvmThreadInstWaitTimeMs() throws SnmpStatusException {
long l = 0;
final ThreadMXBean tmb = JvmThreadingImpl.getThreadMXBean();
if (tmb.isThreadContentionMonitoringSupported()) {
l = info.getWaitedTime();
//Monitoring is disabled
if(l == -1) l = 0;
}
return new Long(l);
}
示例4: checkJvmThreadContentionMonitoring
import java.lang.management.ThreadMXBean; //导入方法依赖的package包/类
/**
* Checker for the "JvmThreadContentionMonitoring" variable.
*/
public void checkJvmThreadContentionMonitoring(
EnumJvmThreadContentionMonitoring x)
throws SnmpStatusException {
//Can't be set externaly to unsupported state.
if(JvmThreadContentionMonitoringUnsupported.intValue()==x.intValue()) {
log.debug("checkJvmThreadContentionMonitoring",
"Try to set to illegal unsupported value");
throw new SnmpStatusException(SnmpDefinitions.snmpRspWrongValue);
}
if ((JvmThreadContentionMonitoringEnabled.intValue()==x.intValue()) ||
(JvmThreadContentionMonitoringDisabled.intValue()==x.intValue())) {
// The value is valid, but is the feature supported ?
ThreadMXBean mbean = getThreadMXBean();
if(mbean.isThreadContentionMonitoringSupported()) return;
log.debug("checkJvmThreadContentionMonitoring",
"Unsupported operation, can't set state");
throw new
SnmpStatusException(SnmpDefinitions.snmpRspInconsistentValue);
}
log.debug("checkJvmThreadContentionMonitoring",
"Try to set to unknown value");
throw new SnmpStatusException(SnmpDefinitions.snmpRspWrongValue);
}