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


Java AttributeList.iterator方法代码示例

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


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

示例1: setAttributes

import javax.management.AttributeList; //导入方法依赖的package包/类
/**
 * Set the values of several attributes of this MBean.
 *
 * @param attributes THe names and values to be set
 *
 * @return The list of attributes that were set and their new values
 */
@Override
public AttributeList setAttributes(AttributeList attributes) {
    AttributeList response = new AttributeList();

    // Validate the input parameters
    if (attributes == null)
        return response;
    
    // Prepare and return our response, eating all exceptions
    String names[] = new String[attributes.size()];
    int n = 0;
    Iterator<?> items = attributes.iterator();
    while (items.hasNext()) {
        Attribute item = (Attribute) items.next();
        names[n++] = item.getName();
        try {
            setAttribute(item);
        } catch (Exception e) {
            // Ignore all exceptions
        }
    }

    return (getAttributes(names));

}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:33,代码来源:BaseModelMBean.java

示例2: setAttributes

import javax.management.AttributeList; //导入方法依赖的package包/类
/**
 * Set the values of several attributes of this MBean.
 *
 * @param attributes THe names and values to be set
 *
 * @return The list of attributes that were set and their new values
 */
public AttributeList setAttributes(AttributeList attributes) {
    AttributeList response = new AttributeList();

    // Validate the input parameters
    if (attributes == null)
        return response;
    
    // Prepare and return our response, eating all exceptions
    String names[] = new String[attributes.size()];
    int n = 0;
    Iterator items = attributes.iterator();
    while (items.hasNext()) {
        Attribute item = (Attribute) items.next();
        names[n++] = item.getName();
        try {
            setAttribute(item);
        } catch (Exception e) {
            ; // Ignore all exceptions
        }
    }

    return (getAttributes(names));

}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:32,代码来源:BaseModelMBean.java

示例3: setAttributes

import javax.management.AttributeList; //导入方法依赖的package包/类
public AttributeList setAttributes(AttributeList attributes) {
  if (attributes == null)
    throw new RuntimeOperationsException(new IllegalArgumentException(
        LocalizedStrings.MX4JModelMBean_ATTRIBUTE_LIST_CANNOT_BE_NULL.toLocalizedString()));

  Logger logger = getLogger();

  AttributeList list = new AttributeList();
  for (Iterator i = attributes.iterator(); i.hasNext();) {
    Attribute attribute = (Attribute) i.next();
    String name = attribute.getName();
    try {
      setAttribute(attribute);
      list.add(attribute);
    } catch (Exception x) {
      if (logger.isEnabledFor(Logger.TRACE))
        logger.trace("setAttribute for attribute " + name + " failed", x);
      // And go on with the next one
    }
  }
  return list;
}
 
开发者ID:ampool,项目名称:monarch,代码行数:23,代码来源:MX4JModelMBean.java

示例4: setAttributes

import javax.management.AttributeList; //导入方法依赖的package包/类
/**
 * Set the values of several attributes of this MBean.
 *
 * @param attributes
 *            THe names and values to be set
 *
 * @return The list of attributes that were set and their new values
 */
@Override
public AttributeList setAttributes(AttributeList attributes) {
	AttributeList response = new AttributeList();

	// Validate the input parameters
	if (attributes == null)
		return response;

	// Prepare and return our response, eating all exceptions
	String names[] = new String[attributes.size()];
	int n = 0;
	Iterator<?> items = attributes.iterator();
	while (items.hasNext()) {
		Attribute item = (Attribute) items.next();
		names[n++] = item.getName();
		try {
			setAttribute(item);
		} catch (Exception e) {
			// Ignore all exceptions
		}
	}

	return (getAttributes(names));

}
 
开发者ID:how2j,项目名称:lazycat,代码行数:34,代码来源:BaseModelMBean.java

示例5: setAttributes

import javax.management.AttributeList; //导入方法依赖的package包/类
public AttributeList setAttributes(AttributeList attributes) 
 {
       // Check attributes is not null to avoid NullPointerException later on
       //
       if (attributes != null) 
       {
        AttributeList resultList = new AttributeList();

        // If attributeNames is empty, nothing more to do
        //
        if (attributes.isEmpty())
            return resultList;

        // For each attribute, try to set it and add to the result list if
        // successfull
        //
        for (Iterator i = attributes.iterator(); i.hasNext();)
        {
            Attribute attr = (Attribute) i.next();
            try
            {
                setAttribute(attr);
                String name = attr.getName();
                Object value = getAttribute(name); 
                resultList.add(new Attribute(name,value));
            } 
            catch(Exception e)
            {
                e.printStackTrace();
            }
        }
        return resultList;
   	}
       return null;
}
 
开发者ID:costea7,项目名称:ChronoBike,代码行数:36,代码来源:BaseCloseMBean.java

示例6: setAttributes

import javax.management.AttributeList; //导入方法依赖的package包/类
public AttributeList setAttributes(AttributeList attributes) {
    AttributeList list = new AttributeList();
    // We carefully avoid using any new stuff from AttributeList here!
    for (Iterator<?> it = attributes.iterator(); it.hasNext(); ) {
        Attribute attr = (Attribute) it.next();
        try {
            setAttribute(attr);
            list.add(attr);
        } catch (Exception e) {
            // OK: ignore per spec
        }
    }
    return list;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:15,代码来源:OldMBeanServerTest.java


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