當前位置: 首頁>>代碼示例>>Java>>正文


Java ThreadMXBean.isThreadContentionMonitoringSupported方法代碼示例

本文整理匯總了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;
    }
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:25,代碼來源:JvmThreadingImpl.java

示例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);
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:17,代碼來源:JvmThreadInstanceEntryImpl.java

示例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);
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:17,代碼來源:JvmThreadInstanceEntryImpl.java

示例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);
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:31,代碼來源:JvmThreadingImpl.java


注:本文中的java.lang.management.ThreadMXBean.isThreadContentionMonitoringSupported方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。