/**
* Returns the values of several attributes in the ModelMBean.
* Executes a getAttribute for each attribute name in the
* attrNames array passed in.
*
* @param attrNames A String array of names of the attributes
* to be retrieved.
*
* @return The array of the retrieved attributes.
*
* @exception RuntimeOperationsException Wraps an
* {@link IllegalArgumentException}: The object name in parameter is
* null or attributes in parameter is null.
*
* @see #setAttributes(javax.management.AttributeList)
*/
public AttributeList getAttributes(String[] attrNames) {
if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
MODELMBEAN_LOGGER.log(Level.TRACE,
RequiredModelMBean.class.getName(), "Entry");
}
if (attrNames == null)
throw new RuntimeOperationsException(new
IllegalArgumentException("attributeNames must not be null"),
"Exception occurred trying to get attributes of a "+
"RequiredModelMBean");
AttributeList responseList = new AttributeList();
for (int i = 0; i < attrNames.length; i++) {
try {
responseList.add(new Attribute(attrNames[i],
getAttribute(attrNames[i])));
} catch (Exception e) {
// eat exceptions because interface doesn't have an
// exception on it
if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
MODELMBEAN_LOGGER.log(Level.TRACE,
"Failed to get \"" + attrNames[i] + "\": ", e);
}
}
}
if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
MODELMBEAN_LOGGER.log(Level.TRACE, "Exit");
}
return responseList;
}
RequiredModelMBean.java 文件源码
java
阅读 24
收藏 0
点赞 0
评论 0
项目:openjdk-jdk10
作者:
评论列表
文章目录