public static double getProcessCpuLoad() throws Exception {
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
ObjectName name = ObjectName.getInstance("java.lang:type=OperatingSystem");
AttributeList list = mbs.getAttributes(name, new String[] { "SystemCpuLoad" });
if (list.isEmpty())
return Double.NaN;
Attribute att = (Attribute) list.get(0);
Double value = (Double) att.getValue();
// usually takes a couple of seconds before we get real values
if (value == -1.0)
return Double.NaN;
// returns a percentage value with 1 decimal point precision
return value;
}
java类javax.management.Attribute的实例源码
CpuUsage.java 文件源码
项目:keyboard-light-composer
阅读 23
收藏 0
点赞 0
评论 0
MetricsDynamicMBeanBase.java 文件源码
项目:hadoop-oss
阅读 25
收藏 0
点赞 0
评论 0
@Override
public AttributeList getAttributes(String[] attributeNames) {
if (attributeNames == null || attributeNames.length == 0)
throw new IllegalArgumentException();
updateMbeanInfoIfMetricsListChanged();
AttributeList result = new AttributeList(attributeNames.length);
for (String iAttributeName : attributeNames) {
try {
Object value = getAttribute(iAttributeName);
result.add(new Attribute(iAttributeName, value));
} catch (Exception e) {
continue;
}
}
return result;
}
DynamicWritableWrapper.java 文件源码
项目:hashsdn-controller
阅读 24
收藏 0
点赞 0
评论 0
@Override
public synchronized void setAttribute(final Attribute attribute)
throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException {
Attribute newAttribute = attribute;
if (configBeanModificationDisabled.get()) {
throw new IllegalStateException("Operation is not allowed now");
}
if ("Attribute".equals(newAttribute.getName())) {
setAttribute((Attribute) newAttribute.getValue());
return;
}
try {
if (newAttribute.getValue() instanceof ObjectName) {
newAttribute = fixDependencyAttribute(newAttribute);
} else if (newAttribute.getValue() instanceof ObjectName[]) {
newAttribute = fixDependencyListAttribute(newAttribute);
}
internalServer.setAttribute(objectNameInternal, newAttribute);
} catch (final InstanceNotFoundException e) {
throw new MBeanException(e);
}
}
JMXAccessorSetTask.java 文件源码
项目:tomcat7
阅读 21
收藏 0
点赞 0
评论 0
/**
* @param jmxServerConnection
* @param name
* @throws Exception
*/
protected String jmxSet(MBeanServerConnection jmxServerConnection,
String name) throws Exception {
Object realValue;
if (type != null) {
realValue = convertStringToType(value, type);
} else {
if (isConvert()) {
String mType = getMBeanAttributeType(jmxServerConnection, name,
attribute);
realValue = convertStringToType(value, mType);
} else
realValue = value;
}
jmxServerConnection.setAttribute(new ObjectName(name), new Attribute(
attribute, realValue));
return null;
}
BaseModelMBean.java 文件源码
项目:tomcat7
阅读 19
收藏 0
点赞 0
评论 0
/**
* Obtain and return the values of several attributes of this MBean.
*
* @param names Names of the requested attributes
*/
@Override
public AttributeList getAttributes(String names[]) {
// Validate the input parameters
if (names == null)
throw new RuntimeOperationsException
(new IllegalArgumentException("Attribute names list is null"),
"Attribute names list is null");
// Prepare our response, eating all exceptions
AttributeList response = new AttributeList();
for (int i = 0; i < names.length; i++) {
try {
response.add(new Attribute(names[i],getAttribute(names[i])));
} catch (Exception e) {
// Not having a particular attribute in the response
// is the indication of a getter problem
}
}
return (response);
}
BaseModelMBean.java 文件源码
项目:tomcat7
阅读 20
收藏 0
点赞 0
评论 0
/**
* 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));
}
BaseModelMBean.java 文件源码
项目:tomcat7
阅读 22
收藏 0
点赞 0
评论 0
/**
* Send an <code>AttributeChangeNotification</code> to all registered
* listeners.
*
* @param oldValue The original value of the <code>Attribute</code>
* @param newValue The new value of the <code>Attribute</code>
*
* @exception MBeanException if an object initializer throws an
* exception
* @exception RuntimeOperationsException wraps IllegalArgumentException
* when the specified notification is <code>null</code> or invalid
*/
@Override
public void sendAttributeChangeNotification
(Attribute oldValue, Attribute newValue)
throws MBeanException, RuntimeOperationsException {
// Calculate the class name for the change notification
String type = null;
if (newValue.getValue() != null)
type = newValue.getValue().getClass().getName();
else if (oldValue.getValue() != null)
type = oldValue.getValue().getClass().getName();
else
return; // Old and new are both null == no change
AttributeChangeNotification notification =
new AttributeChangeNotification
(this, 1, System.currentTimeMillis(),
"Attribute value has changed",
oldValue.getName(), type,
oldValue.getValue(), newValue.getValue());
sendAttributeChangeNotification(notification);
}
Diagnostics.java 文件源码
项目:twitch4j-chatbot
阅读 34
收藏 0
点赞 0
评论 0
/**
* Get CPU Load of Host System
*
* @author http://stackoverflow.com/questions/18489273/how-to-get-percentage-of-cpu-usage-of-os-from-java
*/
private double getCpuLoad() {
try {
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
ObjectName name = ObjectName.getInstance("java.lang:type=OperatingSystem");
AttributeList list = mbs.getAttributes(name, new String[]{"ProcessCpuLoad"});
if (list.isEmpty())
return Double.NaN;
Attribute att = (Attribute) list.get(0);
Double value = (Double) att.getValue();
// usually takes a couple of seconds before we get real values
if (value == -1.0)
return Double.NaN;
// returns a percentage value with 1 decimal point precision
return ((int) (value * 1000) / 10.0);
} catch (Exception e) {
return Double.NaN;
}
}
BaseModelMBean.java 文件源码
项目:lams
阅读 26
收藏 0
点赞 0
评论 0
/**
* Obtain and return the values of several attributes of this MBean.
*
* @param names Names of the requested attributes
*/
public AttributeList getAttributes(String names[]) {
// Validate the input parameters
if (names == null)
throw new RuntimeOperationsException
(new IllegalArgumentException("Attribute names list is null"),
"Attribute names list is null");
// Prepare our response, eating all exceptions
AttributeList response = new AttributeList();
for (int i = 0; i < names.length; i++) {
try {
response.add(new Attribute(names[i],getAttribute(names[i])));
} catch (Exception e) {
; // Not having a particular attribute in the response
; // is the indication of a getter problem
}
}
return (response);
}
JmxInfoProviderSupport.java 文件源码
项目:ibm-cos-sdk-java
阅读 19
收藏 0
点赞 0
评论 0
@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;
}
RMIConnectorLogAttributesTest.java 文件源码
项目:jdk8u-jdk
阅读 29
收藏 0
点赞 0
评论 0
private void doTest(JMXConnector connector) throws IOException,
MalformedObjectNameException, ReflectionException,
InstanceAlreadyExistsException, MBeanRegistrationException,
MBeanException, NotCompliantMBeanException, InstanceNotFoundException, AttributeNotFoundException, InvalidAttributeValueException {
MBeanServerConnection mbsc = connector.getMBeanServerConnection();
ObjectName objName = new ObjectName("com.redhat.test.jmx:type=NameMBean");
System.out.println("DEBUG: Calling createMBean");
mbsc.createMBean(Name.class.getName(), objName);
System.out.println("DEBUG: Calling setAttributes");
AttributeList attList = new AttributeList();
attList.add(new Attribute("FirstName", ANY_NAME));
attList.add(new Attribute("LastName", ANY_NAME));
mbsc.setAttributes(objName, attList);
}
AbstractDynamicWrapperTest.java 文件源码
项目:hashsdn-controller
阅读 19
收藏 0
点赞 0
评论 0
@Test
public void testReadAttributes() throws Exception {
DynamicMBean proxy = JMX.newMBeanProxy(platformMBeanServer, threadPoolDynamicWrapperON, DynamicMBean.class);
assertEquals(threadCount, proxy.getAttribute(THREAD_COUNT));
assertEquals(threadPoolConfigBean.isTriggerNewInstanceCreation(),
proxy.getAttribute(TRIGGER_NEW_INSTANCE_CREATION));
AttributeList attributes = proxy.getAttributes(new String[] { THREAD_COUNT, TRIGGER_NEW_INSTANCE_CREATION });
assertEquals(2, attributes.size());
Attribute threadCountAttr = (Attribute) attributes.get(0);
assertEquals(THREAD_COUNT, threadCountAttr.getName());
assertEquals(threadCount, threadCountAttr.getValue());
Attribute boolTestAttr = (Attribute) attributes.get(1);
assertEquals(TRIGGER_NEW_INSTANCE_CREATION, boolTestAttr.getName());
assertEquals(threadPoolConfigBean.isTriggerNewInstanceCreation(), boolTestAttr.getValue());
MBeanInfo beanInfo = proxy.getMBeanInfo();
assertEquals(2, beanInfo.getAttributes().length);
}
RMIConnector.java 文件源码
项目:OpenJSharp
阅读 23
收藏 0
点赞 0
评论 0
public void setAttribute(ObjectName name,
Attribute attribute)
throws InstanceNotFoundException,
AttributeNotFoundException,
InvalidAttributeValueException,
MBeanException,
ReflectionException,
IOException {
if (logger.debugOn()) logger.debug("setAttribute",
"name=" + name + ", attribute="
+ attribute);
final MarshalledObject<Attribute> sAttribute =
new MarshalledObject<Attribute>(attribute);
final ClassLoader old = pushDefaultClassLoader();
try {
connection.setAttribute(name, sAttribute, delegationSubject);
} catch (IOException ioe) {
communicatorAdmin.gotIOException(ioe);
connection.setAttribute(name, sAttribute, delegationSubject);
} finally {
popDefaultClassLoader(old);
}
}
MX4JModelMBean.java 文件源码
项目:monarch
阅读 35
收藏 0
点赞 0
评论 0
public void sendAttributeChangeNotification(Attribute oldAttribute, Attribute newAttribute)
throws MBeanException, RuntimeOperationsException {
if (oldAttribute == null || newAttribute == null)
throw new RuntimeOperationsException(new IllegalArgumentException(
LocalizedStrings.MX4JModelMBean_ATTRIBUTE_CANNOT_BE_NULL.toLocalizedString()));
if (!oldAttribute.getName().equals(newAttribute.getName()))
throw new RuntimeOperationsException(new IllegalArgumentException(
LocalizedStrings.MX4JModelMBean_ATTRIBUTE_NAMES_CANNOT_BE_DIFFERENT.toLocalizedString()));
// TODO: the source must be the object name of the MBean if the listener was registered through
// MBeanServer
Object oldValue = oldAttribute.getValue();
AttributeChangeNotification n = new AttributeChangeNotification(this, 1,
System.currentTimeMillis(), "Attribute value changed", oldAttribute.getName(),
oldValue == null ? null : oldValue.getClass().getName(), oldValue, newAttribute.getValue());
sendAttributeChangeNotification(n);
}
MX4JModelMBean.java 文件源码
项目:monarch
阅读 23
收藏 0
点赞 0
评论 0
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;
}
BaseCloseMBean.java 文件源码
项目:ChronoBike
阅读 22
收藏 0
点赞 0
评论 0
public AttributeList getAttributes(String[] attributeNames)
{
if(attributeNames != null)
{
AttributeList resultList = new AttributeList();
if (attributeNames.length == 0)
return resultList;
// Build the result attribute list
for(int i=0 ; i<attributeNames.length; i++)
{
try
{
Object oValue = getAttribute(attributeNames[i]);
resultList.add(new Attribute(attributeNames[i], oValue));
}
catch (Exception e)
{
}
}
return resultList;
}
return null;
}
JMXAccessorSetTask.java 文件源码
项目:apache-tomcat-7.0.73-with-comment
阅读 26
收藏 0
点赞 0
评论 0
/**
* @param jmxServerConnection
* @param name
* @throws Exception
*/
protected String jmxSet(MBeanServerConnection jmxServerConnection,
String name) throws Exception {
Object realValue;
if (type != null) {
realValue = convertStringToType(value, type);
} else {
if (isConvert()) {
String mType = getMBeanAttributeType(jmxServerConnection, name,
attribute);
realValue = convertStringToType(value, mType);
} else
realValue = value;
}
jmxServerConnection.setAttribute(new ObjectName(name), new Attribute(
attribute, realValue));
return null;
}
DynamicWritableWrapperTest.java 文件源码
项目:hashsdn-controller
阅读 22
收藏 0
点赞 0
评论 0
@Test
public void testSetAttribute() throws Exception {
DynamicMBean proxy = JMX.newMBeanProxy(platformMBeanServer, threadPoolDynamicWrapperON, DynamicMBean.class);
proxy.setAttribute(new Attribute(THREAD_COUNT, newThreadCount));
assertEquals(newThreadCount, proxy.getAttribute(THREAD_COUNT));
assertEquals(newThreadCount, threadPoolConfigBean.getThreadCount());
AttributeList attributeList = new AttributeList();
attributeList.add(new Attribute(THREAD_COUNT, threadCount));
boolean bool = true;
attributeList.add(new Attribute(TRIGGER_NEW_INSTANCE_CREATION, bool));
proxy.setAttributes(attributeList);
assertEquals(threadCount, threadPoolConfigBean.getThreadCount());
assertEquals(bool, threadPoolConfigBean.isTriggerNewInstanceCreation());
}
BaseModelMBean.java 文件源码
项目:apache-tomcat-7.0.73-with-comment
阅读 25
收藏 0
点赞 0
评论 0
/**
* Send an <code>AttributeChangeNotification</code> to all registered
* listeners.
*
* @param oldValue The original value of the <code>Attribute</code>
* @param newValue The new value of the <code>Attribute</code>
*
* @exception MBeanException if an object initializer throws an
* exception
* @exception RuntimeOperationsException wraps IllegalArgumentException
* when the specified notification is <code>null</code> or invalid
*/
@Override
public void sendAttributeChangeNotification
(Attribute oldValue, Attribute newValue)
throws MBeanException, RuntimeOperationsException {
// Calculate the class name for the change notification
String type = null;
if (newValue.getValue() != null)
type = newValue.getValue().getClass().getName();
else if (oldValue.getValue() != null)
type = oldValue.getValue().getClass().getName();
else
return; // Old and new are both null == no change
AttributeChangeNotification notification =
new AttributeChangeNotification
(this, 1, System.currentTimeMillis(),
"Attribute value has changed",
oldValue.getName(), type,
oldValue.getValue(), newValue.getValue());
sendAttributeChangeNotification(notification);
}
Diagnostics.java 文件源码
项目:momo-2
阅读 26
收藏 0
点赞 0
评论 0
private static double getCpuLoad() {
// http://stackoverflow.com/questions/18489273/how-to-get-percentage-of-cpu-usage-of-os-from-java
try {
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
ObjectName name = ObjectName.getInstance("java.lang:type=OperatingSystem");
AttributeList list = mbs.getAttributes(name, new String[]{ "ProcessCpuLoad" });
if (list.isEmpty())
return Double.NaN;
Attribute att = (Attribute)list.get(0);
Double value = (Double)att.getValue();
// usually takes a couple of seconds before we get real values
if (value == -1.0)
return Double.NaN;
// returns a percentage value with 1 decimal point precision
return ((int)(value * 1000) / 10.0);
} catch(Exception e) {
return Double.NaN;
}
}
RMIConnector.java 文件源码
项目:openjdk-jdk10
阅读 23
收藏 0
点赞 0
评论 0
public void setAttribute(ObjectName name,
Attribute attribute)
throws InstanceNotFoundException,
AttributeNotFoundException,
InvalidAttributeValueException,
MBeanException,
ReflectionException,
IOException {
if (logger.debugOn()) logger.debug("setAttribute",
"name=" + name + ", attribute name="
+ attribute.getName());
final MarshalledObject<Attribute> sAttribute =
new MarshalledObject<Attribute>(attribute);
final ClassLoader old = pushDefaultClassLoader();
try {
connection.setAttribute(name, sAttribute, delegationSubject);
} catch (IOException ioe) {
communicatorAdmin.gotIOException(ioe);
connection.setAttribute(name, sAttribute, delegationSubject);
} finally {
popDefaultClassLoader(old);
}
}
BaseModelMBean.java 文件源码
项目:lazycat
阅读 18
收藏 0
点赞 0
评论 0
/**
* Obtain and return the values of several attributes of this MBean.
*
* @param names
* Names of the requested attributes
*/
@Override
public AttributeList getAttributes(String names[]) {
// Validate the input parameters
if (names == null)
throw new RuntimeOperationsException(new IllegalArgumentException("Attribute names list is null"),
"Attribute names list is null");
// Prepare our response, eating all exceptions
AttributeList response = new AttributeList();
for (int i = 0; i < names.length; i++) {
try {
response.add(new Attribute(names[i], getAttribute(names[i])));
} catch (Exception e) {
// Not having a particular attribute in the response
// is the indication of a getter problem
}
}
return (response);
}
DynamicWritableWrapper.java 文件源码
项目:hashsdn-controller
阅读 34
收藏 0
点赞 0
评论 0
@Override
public AttributeList setAttributes(final AttributeList attributes) {
AttributeList result = new AttributeList();
for (Object attributeObject : attributes) {
Attribute attribute = (Attribute) attributeObject;
try {
setAttribute(attribute);
result.add(attribute);
} catch (final InvalidAttributeValueException | AttributeNotFoundException | MBeanException
| ReflectionException e) {
LOG.warn("Setting attribute {} failed on {}", attribute.getName(), moduleIdentifier, e);
throw new IllegalArgumentException(
"Setting attribute failed - " + attribute.getName() + " on " + moduleIdentifier, e);
}
}
return result;
}
FolderMBean.java 文件源码
项目:Pogamut3
阅读 24
收藏 0
点赞 0
评论 0
@Override
public void setAttribute(Attribute attribute) throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException {
try {
folder.getProperty(attribute.getName()).setValue(attribute.getValue());
} catch (IntrospectionException ex) {
throw new MBeanException(ex);
}
}
JMXTest.java 文件源码
项目:kmanager
阅读 23
收藏 0
点赞 0
评论 0
public static void objectNames(KafkaJMX kafkaJMX) {
kafkaJMX.doWithConnection("10.16.238.94", 8888, Optional.of(""), Optional.of(""), false, new JMXExecutor() {
@Override
public void doWithConnection(MBeanServerConnection mbsc) {
// KafkaMetrics kafkaMetrics = new KafkaMetrics();
try (FileWriter fw = new FileWriter("objectNames.json", true);
BufferedWriter bw = new BufferedWriter(fw);
PrintWriter out = new PrintWriter(bw)) {
Set<ObjectInstance> beans = mbsc.queryMBeans(null, null);
JSONArray objectName = new JSONArray();
for (ObjectInstance bean : beans) {
if (excludeInternalTopic && bean.getObjectName().toString().contains("__consumer_offsets")) {
continue;
}
System.out.println("ObjectName: " + bean.getObjectName());
objectName.put(bean.getObjectName().toString());
MBeanInfo mbeanInfo = mbsc.getMBeanInfo(bean.getObjectName());
System.out.println("\tMBeanInfo: " + mbeanInfo);
MBeanAttributeInfo[] attributes = mbeanInfo.getAttributes();
String[] attributeArr = new String[attributes.length];
for (int i = 0; i < attributes.length; i++) {
attributeArr[i] = attributes[i].getName();
}
AttributeList attributeList = mbsc.getAttributes(bean.getObjectName(), attributeArr);
List<Attribute> attributeList1 = attributeList.asList();
for (Attribute attr : attributeList1) {
System.out.println("\t\tName: " + attr.getName() + " Value: " + attr.getValue());
}
}
out.println(objectName.toString());
} catch (Exception e) {
}
}
});
}
AttributeToPropertyAdapter.java 文件源码
项目:Pogamut3
阅读 18
收藏 0
点赞 0
评论 0
@Override
public void setValue(Object newValue) throws IntrospectionException {
try {
folderMBean.setAttribute(new Attribute(getName(), newValue));
} catch (Exception ex) {
throw new IntrospectionException(ex);
}
}
MetricsSourceAdapter.java 文件源码
项目:hadoop-oss
阅读 33
收藏 0
点赞 0
评论 0
@Override
public Object getAttribute(String attribute)
throws AttributeNotFoundException, MBeanException, ReflectionException {
updateJmxCache();
synchronized(this) {
Attribute a = attrCache.get(attribute);
if (a == null) {
throw new AttributeNotFoundException(attribute +" not found");
}
if (LOG.isDebugEnabled()) {
LOG.debug(attribute +": "+ a);
}
return a.getValue();
}
}
MBeanExceptionTest.java 文件源码
项目:openjdk-jdk10
阅读 29
收藏 0
点赞 0
评论 0
public void setAttribute(Attribute attr)
throws MBeanException {
String attrName = attr.getName();
if (attrName.equals("UncheckedException"))
throw theUncheckedException;
else
throw new AssertionError();
}
JmxReporter.java 文件源码
项目:tqdev-metrics
阅读 31
收藏 0
点赞 0
评论 0
@Override
public void setAttribute(Attribute attribute)
throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException {
if (attribute.getName().equals("enabled")) {
registry.setEnabled((boolean) attribute.getValue());
} else {
throw new AttributeNotFoundException("No writable attribute has been found");
}
}
RequiredModelMBean.java 文件源码
项目:openjdk-jdk10
阅读 25
收藏 0
点赞 0
评论 0
/**
* 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;
}