Package javax.management

Examples of javax.management.Attribute


            {
                String attribute = attributes[i];
                try
                {
                    Object result = getAttribute(attribute);
                    list.add(new Attribute(attribute, result));
                }
                catch (AttributeNotFoundException ignored)
                {
                }
                catch (MBeanException ignored)
View Full Code Here


        if (attributes != null)
        {
            for (int i = 0; i < attributes.size(); ++i)
            {
                Attribute attribute = (Attribute) attributes.get(i);
                try
                {
                    setAttribute(attribute);
                    list.add(attribute);
                }
View Full Code Here

        // of a single check call - and not do a check call for each attribute
        final AttributeList result = this.getAttributes(new String[] {attribute});
        if ( result.size() == 0 ) {
            throw new AttributeNotFoundException(attribute);
        }
        final Attribute attr = (Attribute) result.get(0);
        return attr.getValue();
    }
View Full Code Here

        if ( attributes != null ) {
            HealthCheckExecutionResult hcResult = null;
            for(final String key : attributes) {
                final Object defaultValue = this.defaultAttributes.get(key);
                if ( defaultValue != null ) {
                    result.add(new Attribute(key, defaultValue));
                } else {
                    // we assume that a valid attribute name is used
                    // which is requesting a hc result
                    if ( hcResult == null ) {
                        hcResult = this.getHealthCheckResult();
                    }

                    if ( HC_OK_ATTRIBUTE_NAME.equals(key) ) {
                        result.add(new Attribute(key, hcResult.getHealthCheckResult().isOk()));
                    } else if ( HC_LOG_ATTRIBUTE_NAME.equals(key) ) {
                        try {
                            result.add(new Attribute(key, logData(hcResult.getHealthCheckResult())));
                        } catch ( final OpenDataException ignore ) {
                            // we ignore this and simply don't add the attribute
                        }
                    } else if ( HC_STATUS_ATTRIBUTE_NAME.equals(key) ) {
                        result.add(new Attribute(key, hcResult.getHealthCheckResult().getStatus().toString()));
                    } else if ( HC_ELAPSED_TIMED_ATTRIBUTE_NAME.equals(key) ) {
                        result.add(new Attribute(key, hcResult.getElapsedTimeInMs()));
                    } else if ( HC_FINISHED_AT_ATTRIBUTE_NAME.equals(key) ) {
                        result.add(new Attribute(key, hcResult.getFinishedAt()));
                    } else if ( HC_TIMED_OUT_ATTRIBUTE_NAME.equals(key) ) {
                        result.add(new Attribute(key, hcResult.hasTimedOut()));
                    }
                }
            }
        }
View Full Code Here

        AttributeList results = new AttributeList(attributes.length);
        for (int i = 0; i < attributes.length; i++) {
            String name = attributes[i];
            try {
                Object value = getAttribute(name);
                results.add(new Attribute(name, value));
            } catch (JMException e) {
                log.warn("Exception while getting attribute " + name, e);
            }
        }
        return results;
View Full Code Here

    }

    public AttributeList setAttributes(AttributeList attributes) {
        AttributeList results = new AttributeList(attributes.size());
        for (Iterator iterator = attributes.iterator(); iterator.hasNext();) {
            Attribute attribute = (Attribute) iterator.next();
            try {
                setAttribute(attribute);
                results.add(attribute);
            } catch (JMException e) {
                log.warn("Exception while setting attribute " + attribute.getName(), e);
            }
        }
        return results;
    }
View Full Code Here

            Thread.sleep(1500);

            System.out.println("Checking the IntervalSeconds property");
            Object o = mbeanServer.getAttribute(objectName, "IntervalSeconds");
            System.out.println("IntervalSeconds was " + o + ", setting it to 2");
            mbeanServer.setAttribute(objectName, new Attribute("IntervalSeconds", 2));
            System.out.println("IntervalSeconds set");

            //A little sleep to give the logging resulting from the new interval time to show up in the logs
            Thread.sleep(3000);
        } finally {
View Full Code Here

        AttributeList al = new AttributeList();
        Iterator<Entry<String, TimeSeries>> statIter = statistics.iterator();
        while (statIter.hasNext()) {
            Entry<String, TimeSeries> entry = statIter.next();
            long[] valuePerSecond = entry.getValue().getValuePerSecond();
            al.add(new Attribute("PerSecond_" + entry.getKey(),
                    valuePerSecond[valuePerSecond.length - 1]));
            al.add(new Attribute(
                    "LastMinutePerSecond_" + entry.getKey(),
                    valuePerSecond));
            long[] valuePerMinute = entry.getValue().getValuePerMinute();
            al.add(new Attribute("PerMinute" + entry.getKey(),
                    valuePerMinute[valuePerMinute.length - 1]));
            al.add(new Attribute("LastHourPerMinute_" + entry.getKey(),
                    valuePerMinute));
            long[] valuePerHour = entry.getValue().getValuePerHour();
            al.add(new Attribute("PerHour_" + entry.getKey(),
                    valuePerHour[valuePerHour.length - 1]));
            al.add(new Attribute("LastWeekPerHour_" + entry.getKey(),
                    valuePerHour));
            long[] valuePerWeek = entry.getValue().getValuePerWeek();
            al.add(new Attribute("PerWeek_" + entry.getKey(),
                    valuePerWeek[valuePerWeek.length - 1]));
            al.add(new Attribute("LastYearPerWeek_" + entry.getKey(),
                    valuePerWeek));
        }
        return al;
    }
View Full Code Here

        result.put(Constants.PROP_OBJECTNAME, this.objectName.getCanonicalName());

        final AttributeList values = this.getAttributes();
        final Iterator iter = values.iterator();
        while ( iter.hasNext() ) {
            final Attribute a = (Attribute)iter.next();
            final Object value = a.getValue();
            if ( value != null ) {
                result.put(a.getName(), value);
            }
        }

        return result;
    }
View Full Code Here

                    for(final MBeanAttributeInfo mai : info.mbeanInfo.getAttributes()) {
                        if ( mai.getName().equals(attrName) ) {
                            final Iterator iter = result.iterator();
                            Object value = null;
                            while ( iter.hasNext() && value == null ) {
                                final Attribute a = (Attribute) iter.next();
                                if ( a.getName().equals(attrName) ) {
                                    value = a.getValue();
                                }
                            }
                            final AttributeResource rsrc = new AttributeResource(resourceResolver, path, mai, value, parentAttributesResource);
                            if ( subPath != null ) {
                                return rsrc.getChildResource(subPath);
View Full Code Here

TOP

Related Classes of javax.management.Attribute

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.