本文整理了Java中javax.management.AttributeList.add()
方法的一些代码示例,展示了AttributeList.add()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AttributeList.add()
方法的具体详情如下:
包路径:javax.management.AttributeList
类名称:AttributeList
方法名:add
暂无
代码示例来源:origin: apache/kafka
@Override
public AttributeList getAttributes(String[] names) {
AttributeList list = new AttributeList();
for (String name : names) {
try {
list.add(new Attribute(name, getAttribute(name)));
} catch (Exception e) {
log.warn("Error getting JMX attribute '{}'", name, e);
}
}
return list;
}
代码示例来源:origin: org.apache.hadoop/hadoop-common
@Override
public AttributeList getAttributes(String[] attributes) {
updateJmxCache();
synchronized(this) {
AttributeList ret = new AttributeList();
for (String key : attributes) {
Attribute attr = attrCache.get(key);
if (LOG.isDebugEnabled()) {
LOG.debug(key +": "+ attr);
}
ret.add(attr);
}
return ret;
}
}
代码示例来源:origin: org.logicalcobwebs/com.springsource.org.logicalcobwebs.proxool
private void setIntegerAttribute(String attributeName, String propertyName, Object value, int defaultValue, Properties properties,
AttributeList resultList) throws InvalidAttributeValueException {
checkAssignable(attributeName, Integer.class, value);
if (notEmptyOrZero((Integer) value)) {
properties.setProperty(propertyName, value.toString());
resultList.add(new Attribute(attributeName, value));
} else {
resultList.add(new Attribute(attributeName,
new Integer(defaultValue)));
}
}
代码示例来源:origin: apache/hive
@Override
public AttributeList getAttributes(String[] arg0) {
AttributeList results = new AttributeList();
synchronized(metricsMap) {
for (String key : arg0) {
results.add(new Attribute(key,metricsMap.get(key)));
}
}
return results;
}
代码示例来源:origin: wildfly/wildfly
public AttributeList getAttributes(String[] names) {
AttributeList al=new AttributeList();
for(String name: names) {
Attribute attr=getNamedAttribute(name);
if(attr != null)
al.add(attr);
else
log.warn("Did not find attribute " + name);
}
return al;
}
代码示例来源:origin: neo4j/neo4j
@Override
public AttributeList getAttributes( String[] attributes )
{
AttributeList result = new AttributeList( attributes.length );
for ( String attribute : attributes )
{
try
{
result.add( new Attribute( attribute, getAttribute( attribute ) ) );
}
catch ( Exception e )
{
throw new RuntimeException( e );
}
}
return result;
}
代码示例来源:origin: apache/hive
@Override
public AttributeList setAttributes(AttributeList arg0) {
AttributeList attributesSet = new AttributeList();
for (Attribute attr : arg0.asList()) {
try {
setAttribute(attr);
attributesSet.add(attr);
} catch (AttributeNotFoundException e) {
// ignore exception - we simply don't add this attribute
// back in to the resultant set.
} catch (InvalidAttributeValueException e) {
// ditto
} catch (MBeanException e) {
// likewise
} catch (ReflectionException e) {
// and again, one last time.
}
}
return attributesSet;
}
代码示例来源:origin: Netflix/servo
/**
* {@inheritDoc}
*/
@Override
public AttributeList getAttributes(String[] names) {
AttributeList list = new AttributeList();
for (String name : names) {
list.add(new Attribute(name, monitor.getValue()));
}
return list;
}
代码示例来源:origin: wildfly/wildfly
public AttributeList setAttributes(AttributeList list) {
AttributeList results=new AttributeList();
for(int i=0;i < list.size();i++) {
Attribute attr=(Attribute)list.get(i);
if(setNamedAttribute(attr))
results.add(attr);
else {
if(log.isWarnEnabled())
log.warn("Failed to update attribute name " + attr.getName() + " with value " + attr.getValue());
}
}
return results;
}
代码示例来源:origin: btraceio/btrace
@Override
public synchronized AttributeList getAttributes(String[] names) {
AttributeList list = new AttributeList();
for (String name : names) {
Field field = attributes.get(name);
Object value = null;
if (field != null) {
value = getFieldValue(field);
}
if (value != null) {
list.add(new Attribute(name, value));
}
}
return list;
}
代码示例来源:origin: apache/geode
@Override
public AttributeList setAttributes(AttributeList attributes) {
if (attributes == null)
throw new RuntimeOperationsException(new IllegalArgumentException(
"Attribute list cannot be null."));
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;
}
代码示例来源:origin: BroadleafCommerce/BroadleafCommerce
@Override
public AttributeList getAttributes(String[] attributes) {
AttributeList list = new AttributeList();
for (Map.Entry<String, CacheStat> stats : cacheStats.entrySet()) {
list.add(new Attribute(stats.getKey(), stats.getValue().getHitRate().doubleValue()));
}
return list;
}
代码示例来源:origin: javaee/glassfish
public final AttributeList setAttributes(AttributeList attributes) {
AttributeList r = new AttributeList(attributes.size());
for (Object a : attributes) {
try {
setAttribute(Attribute.class.cast(a));
r.add(Attribute.class.cast(a));
} catch (AttributeNotFoundException e) {
// error is silently ignored
} catch (ReflectionException e) {
// error is silently ignored
} catch (MBeanException e) {
// error is silently ignored
} catch (InvalidAttributeValueException e) {
// error is silently ignored
}
}
return r;
}
}
代码示例来源:origin: vipshop/vjtools
private AttributeList getAttributes(ObjectName objName, String[] attrNames)
throws InstanceNotFoundException, ReflectionException, IOException {
final NameValueMap values = getCachedAttributes(objName, new TreeSet<String>(Arrays.asList(attrNames)));
final AttributeList list = new AttributeList();
for (String attrName : attrNames) {
final Object value = values.get(attrName);
if (value != null || values.containsKey(attrName)) {
list.add(new Attribute(attrName, value));
}
}
return list;
}
代码示例来源:origin: net.sf.ehcache/ehcache
/**
* Set an attribute list.
*/
public AttributeList setAttributes(AttributeList list) {
Attribute[] attrs = list.toArray(new Attribute[0]);
AttributeList retlist = new AttributeList();
for (Attribute attr : attrs) {
String name = attr.getName();
AttributeProxy a = map.get(name);
if (a != null && a.isWrite()) {
a.set(name, attr.getValue());
retlist.add(attr);
}
}
return retlist;
}
代码示例来源:origin: log4j/log4j
/**
* Enables the to get the values of several attributes of the Dynamic MBean.
*/
public
AttributeList getAttributes(String[] attributeNames) {
// Check attributeNames is not null to avoid NullPointerException later on
if (attributeNames == null) {
throw new RuntimeOperationsException(
new IllegalArgumentException("attributeNames[] cannot be null"),
"Cannot invoke a getter of " + dClassName);
}
AttributeList resultList = new AttributeList();
// if attributeNames is empty, return an empty result list
if (attributeNames.length == 0)
return resultList;
// build the result attribute list
for (int i=0 ; i<attributeNames.length ; i++){
try {
Object value = getAttribute((String) attributeNames[i]);
resultList.add(new Attribute(attributeNames[i],value));
} catch (JMException e) {
e.printStackTrace();
} catch (RuntimeException e) {
e.printStackTrace();
}
}
return(resultList);
}
代码示例来源:origin: apache/activemq-artemis
public AttributeList getAttributes(String[] names) {
AttributeList al=new AttributeList();
for(String name: names) {
Attribute attr=getNamedAttribute(name);
if(attr != null)
al.add(attr);
else
log.warn("Did not find attribute " + name);
}
return al;
}
代码示例来源:origin: apache/geode
@Override
public AttributeList getAttributes(ObjectName name, String[] attributes)
throws InstanceNotFoundException, ReflectionException {
AttributeList results = new AttributeList();
for (String attribute : attributes) {
try {
Object value = getAttribute(name, attribute);
Attribute att = new Attribute(attribute, value);
results.add(att);
} catch (Exception e) {
throw new GemFireSecurityException("error getting value of " + attribute + " from " + name,
e);
}
}
return results;
}
代码示例来源:origin: apache/activemq-artemis
public AttributeList getAttributes(String[] names) {
AttributeList al=new AttributeList();
for(String name: names) {
Attribute attr=getNamedAttribute(name);
if(attr != null)
al.add(attr);
else
log.warn("Did not find attribute " + name);
}
return al;
}
代码示例来源:origin: log4j/log4j
"Cannot invoke a setter of " + dClassName);
AttributeList resultList = new AttributeList();
String name = attr.getName();
Object value = getAttribute(name);
resultList.add(new Attribute(name,value));
} catch(JMException e) {
e.printStackTrace();
内容来源于网络,如有侵权,请联系作者删除!