Example usage for javax.management AttributeList add

List of usage examples for javax.management AttributeList add

Introduction

In this page you can find the example usage for javax.management AttributeList add.

Prototype

@Override
public boolean add(Object element) 

Source Link

Usage

From source file:com.wakacommerce.common.cache.StatisticsServiceImpl.java

@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()));
    }/*w w  w  .  ja va2 s  . co  m*/
    return list;
}

From source file:com.joyent.manta.http.PoolStatsMBean.java

@Override
public AttributeList getAttributes(final String[] attributes) {
    updatePoolStats();/*from   w w  w  .  j ava 2 s  .c  om*/

    AttributeList list = new AttributeList(NO_OF_PROPERTIES);

    for (String a : attributes) {
        Integer result = getAttributeFromPoolStats(a, this.stats);
        if (result != null) {
            list.add(result);
        }
    }

    return list;
}

From source file:com.ecyrd.management.SimpleMBean.java

/**
 *  Gets multiple attributes at the same time.
 *  /*  ww  w  . ja v a 2  s. c  om*/
 *  @param arg0 The attribute names to get
 *  @return A list of attributes 
 */
public AttributeList getAttributes(String[] arg0) {
    AttributeList list = new AttributeList();

    for (int i = 0; i < arg0.length; i++) {
        try {
            list.add(new Attribute(arg0[i], getAttribute(arg0[i])));
        } catch (AttributeNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (MBeanException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (ReflectionException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

    return list;
}

From source file:com.zavakid.mushroom.impl.MetricsSourceAdapter.java

@Override
public AttributeList getAttributes(String[] attributes) {
    updateJmxCache();/*from   www .  j av a 2  s  .c  om*/
    synchronized (this) {
        AttributeList ret = new AttributeList();
        for (String key : attributes) {
            Attribute attr = attrCache.get(key);
            if (LOG.isDebugEnabled()) {
                LOG.debug(key + ": " + attr.getName() + "=" + attr.getValue());
            }
            ret.add(attr);
        }
        return ret;
    }
}

From source file:com.ecyrd.management.SimpleMBean.java

public AttributeList setAttributes(AttributeList arg0) {
    AttributeList result = new AttributeList();
    for (Iterator i = arg0.iterator(); i.hasNext();) {
        Attribute attr = (Attribute) i.next();

        ////from w  w  w. ja va2  s .c o m
        //  Attempt to set the attribute.  If it succeeds (no exception),
        //  then we just add it to the list of successfull sets.
        //
        try {
            setAttribute(attr);
            result.add(attr);
        } catch (AttributeNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (InvalidAttributeValueException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (MBeanException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (ReflectionException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

    return result;
}

From source file:net.lightbody.bmp.proxy.jetty.util.jmx.ModelMBeanImpl.java

public AttributeList getAttributes(String[] names) {
    log.debug("getAttributes");
    AttributeList results = new AttributeList(names.length);
    for (int i = 0; i < names.length; i++) {
        try {/*w  w w .  j a  v  a2  s.c  om*/
            results.add(new Attribute(names[i], getAttribute(names[i])));
        } catch (Exception e) {
            log.warn(LogSupport.EXCEPTION, e);
        }
    }
    return results;
}

From source file:net.lightbody.bmp.proxy.jetty.util.jmx.ModelMBeanImpl.java

public AttributeList setAttributes(AttributeList attrs) {
    log.debug("setAttributes");

    AttributeList results = new AttributeList(attrs.size());
    Iterator iter = attrs.iterator();
    while (iter.hasNext()) {
        try {/*  w  w  w  .jav  a  2s  .c  o  m*/
            Attribute attr = (Attribute) iter.next();
            setAttribute(attr);
            results.add(new Attribute(attr.getName(), getAttribute(attr.getName())));
        } catch (Exception e) {
            log.warn(LogSupport.EXCEPTION, e);
        }
    }
    return results;
}

From source file:com.cyberway.issue.crawler.admin.CrawlJob.java

public AttributeList getAttributes(String[] attributeNames) {
    if (attributeNames == null) {
        throw new RuntimeOperationsException(
                new IllegalArgumentException("attributeNames[] cannot be " + "null"),
                "Cannot call getAttributes with null attribute " + "names");
    }/*from  ww  w . j a v a 2  s  .com*/

    // If no controller, we can't do any work in here.
    if (this.controller == null) {
        throw new RuntimeOperationsException(new NullPointerException("Controller is null"),
                "Controller is null");
    }

    AttributeList resultList = new AttributeList();
    if (attributeNames.length == 0) {
        return resultList;
    }
    for (int i = 0; i < attributeNames.length; i++) {
        try {
            Object value = getAttribute(attributeNames[i]);
            resultList.add(new Attribute(attributeNames[i], value));
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    return (resultList);
}

From source file:com.cyberway.issue.crawler.admin.CrawlJob.java

public AttributeList setAttributes(AttributeList attributes) {
    if (attributes == null) {
        throw new RuntimeOperationsException(
                new IllegalArgumentException("attributeNames[] cannot be " + "null"),
                "Cannot call getAttributes with null attribute " + "names");
    }// w w w.j  av a2  s. co m

    AttributeList resultList = new AttributeList();
    if (attributes.size() == 0) {
        return resultList;
    }
    for (int i = 0; i < attributes.size(); i++) {
        try {
            Attribute attr = (Attribute) attributes.get(i);
            setAttribute(attr);
            String an = attr.getName();
            Object newValue = getAttribute(an);
            resultList.add(new Attribute(an, newValue));
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    return resultList;
}

From source file:com.cyberway.issue.crawler.Heritrix.java

public AttributeList getAttributes(String[] attributeNames) {
    if (attributeNames == null) {
        throw new RuntimeOperationsException(
                new IllegalArgumentException("attributeNames[] cannot be " + "null"),
                "Cannot call getAttributes with null attribute " + "names");
    }//from  w  w w . j a v  a2 s.com
    AttributeList resultList = new AttributeList();
    if (attributeNames.length == 0) {
        return resultList;
    }
    for (int i = 0; i < attributeNames.length; i++) {
        try {
            Object value = getAttribute(attributeNames[i]);
            resultList.add(new Attribute(attributeNames[i], value));
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    return (resultList);
}