当前位置: 首页>>代码示例>>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;未经允许,请勿转载。