当前位置: 首页>>代码示例>>Java>>正文


Java AttributeList.asList方法代码示例

本文整理汇总了Java中javax.management.AttributeList.asList方法的典型用法代码示例。如果您正苦于以下问题:Java AttributeList.asList方法的具体用法?Java AttributeList.asList怎么用?Java AttributeList.asList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.management.AttributeList的用法示例。


在下文中一共展示了AttributeList.asList方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getFileDecriptorInfo

import javax.management.AttributeList; //导入方法依赖的package包/类
@Override
public long[] getFileDecriptorInfo() {
    MBeanServer mbsc = MBeans.getMBeanServer();
    AttributeList attributes;
    try {
        attributes = mbsc.getAttributes(
            new ObjectName("java.lang:type=OperatingSystem"), 
            new String[]{"OpenFileDescriptorCount", "MaxFileDescriptorCount"});
        List<Attribute> attrList = attributes.asList();
        long openFdCount = (Long)attrList.get(0).getValue();
        long maxFdCount = (Long)attrList.get(1).getValue();
        long[] fdCounts = { openFdCount, maxFdCount};
        return fdCounts;
    } catch (Exception e) {
        LogFactory.getLog(SdkMBeanRegistrySupport.class).debug(
                "Failed to retrieve file descriptor info", e);
    }
    return null;
}
 
开发者ID:IBM,项目名称:ibm-cos-sdk-java,代码行数:20,代码来源:JmxInfoProviderSupport.java

示例2: setAttributes

import javax.management.AttributeList; //导入方法依赖的package包/类
/**
 * Sets the values of an array of attributes of this ModelMBean.
 * Executes the setAttribute() method for each attribute in the list.
 *
 * @param attributes A list of attributes: The identification of the
 * attributes to be set and  the values they are to be set to.
 *
 * @return  The array of attributes that were set, with their new
 *    values in Attribute instances.
 *
 * @exception RuntimeOperationsException Wraps an
 *   {@link IllegalArgumentException}: The object name in parameter
 *   is null or attributes in parameter is null.
 *
 * @see #getAttributes
 **/
public AttributeList setAttributes(AttributeList attributes) {

    if (MODELMBEAN_LOGGER.isLoggable(Level.FINER)) {
        MODELMBEAN_LOGGER.logp(Level.FINER,
                RequiredModelMBean.class.getName(),
            "setAttribute(Attribute)", "Entry");
    }

    if (attributes == null)
        throw new RuntimeOperationsException(new
            IllegalArgumentException("attributes must not be null"),
            "Exception occurred trying to set attributes of a "+
            "RequiredModelMBean");

    final AttributeList responseList = new AttributeList();

    // Go through the list of attributes
    for (Attribute attr : attributes.asList()) {
        try {
            setAttribute(attr);
            responseList.add(attr);
        } catch (Exception excep) {
            responseList.remove(attr);
        }
    }

    return responseList;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:45,代码来源:RequiredModelMBean.java

示例3: setAttributes

import javax.management.AttributeList; //导入方法依赖的package包/类
@Override
public AttributeList setAttributes(ObjectName name, AttributeList attributes)
    throws InstanceNotFoundException, ReflectionException {
  // call setAttribute instead to use the authorization logic
  for (Attribute attribute : attributes.asList()) {
    try {
      setAttribute(name, attribute);
    } catch (Exception e) {
      throw new GemFireSecurityException("error setting attribute " + attribute + " of " + name,
          e);
    }
  }
  return attributes;
}
 
开发者ID:ampool,项目名称:monarch,代码行数:15,代码来源:MBeanServerWrapper.java

示例4: setAttributes

import javax.management.AttributeList; //导入方法依赖的package包/类
/**
 * Sets the values of an array of attributes of this ModelMBean.
 * Executes the setAttribute() method for each attribute in the list.
 *
 * @param attributes A list of attributes: The identification of the
 * attributes to be set and  the values they are to be set to.
 *
 * @return  The array of attributes that were set, with their new
 *    values in Attribute instances.
 *
 * @exception RuntimeOperationsException Wraps an
 *   {@link IllegalArgumentException}: The object name in parameter
 *   is null or attributes in parameter is null.
 *
 * @see #getAttributes
 **/
public AttributeList setAttributes(AttributeList attributes) {

    if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
        MODELMBEAN_LOGGER.log(Level.TRACE, "Entry");
    }

    if (attributes == null)
        throw new RuntimeOperationsException(new
            IllegalArgumentException("attributes must not be null"),
            "Exception occurred trying to set attributes of a "+
            "RequiredModelMBean");

    final AttributeList responseList = new AttributeList();

    // Go through the list of attributes
    for (Attribute attr : attributes.asList()) {
        try {
            setAttribute(attr);
            responseList.add(attr);
        } catch (Exception excep) {
            responseList.remove(attr);
        }
    }

    return responseList;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:43,代码来源:RequiredModelMBean.java

示例5: getDoubleValue

import javax.management.AttributeList; //导入方法依赖的package包/类
private Double getDoubleValue(AttributeList attributes, String name) {
  List<Attribute> _attributes = attributes.asList();
  for (Attribute attr : _attributes) {
    if (attr.getName().equalsIgnoreCase(name)) {
      return (Double) attr.getValue();
    }
  }
  return 0D;
}
 
开发者ID:chickling,项目名称:kmanager,代码行数:10,代码来源:KafkaMetrics.java

示例6: getLongValue

import javax.management.AttributeList; //导入方法依赖的package包/类
private Long getLongValue(AttributeList attributes, String name) {
  List<Attribute> _attributes = attributes.asList();
  for (Attribute attr : _attributes) {
    if (attr.getName().equalsIgnoreCase(name)) {
      return (Long) attr.getValue();
    }
  }
  return 0L;
}
 
开发者ID:chickling,项目名称:kmanager,代码行数:10,代码来源:KafkaMetrics.java


注:本文中的javax.management.AttributeList.asList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。