本文整理匯總了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);
}