本文整理匯總了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}