Package javax.management

Examples of javax.management.AttributeList.asList()


   */
  protected Map<String, Long> getNio() {
    Map<String, Long> map = new HashMap<String, Long>(NIO_ATTRS.length);
    try {
      AttributeList attrs = ManagementFactory.getPlatformMBeanServer().getAttributes(directNio, NIO_ATTRS);
      for(Attribute attr: attrs.asList()) {
        map.put(attr.getName(), (Long)attr.getValue());
      }
    } catch (Exception e) {
      e.printStackTrace(System.err);
    }
View Full Code Here


    }

    private void getAttributeValues (MBeanServerConnection mbsc, String oname, ObjectName objectName, ArrayList<String> attributes, ResmonResult rr) {
        try {
            AttributeList al = mbsc.getAttributes(objectName, attributes.toArray(new String[]{}));
            for (Attribute a : al.asList()) {
                getMetric(oname, a.getName(), a.getValue(), rr);
            }
        }
        catch (Exception e) {
            Jezebel.exceptionTraceLogger(e);
View Full Code Here

        }

        AttributeList attributes = cnx.getAttributes(on, attributeNames);
        Map<String, String> values = new HashMap<String, String>();

        for (javax.management.Attribute attribute : attributes.asList()) {
            Object value = attribute.getValue();

            values.put(attribute.getName(), value == null ? "" : value.toString());
        }
View Full Code Here

            final ObjectName on = LogStoreResource.getObjectName(resource);
            final ModelNode model = resource.getModel().clone();

            AttributeList attributes = mbs.getAttributes(on, LogStoreConstants.PARTICIPANT_JMX_NAMES);

            for (javax.management.Attribute attribute : attributes.asList()) {
                String modelName = LogStoreConstants.jmxNameToModelName(LogStoreConstants.MODEL_TO_JMX_PARTICIPANT_NAMES, attribute.getName());

                if (modelName != null) {
                    ModelNode aNode = model.get(modelName);
                    Object value = attribute.getValue();
View Full Code Here

            if (oldNames != null) {
                attrNames.addAll(oldNames);
            }
            values = new NameValueMap();
            final AttributeList attrs = conn.getAttributes(objName, attrNames.toArray(new String[attrNames.size()]));
            for (Attribute attr : attrs.asList()) {
                values.put(attr.getName(), attr.getValue());
            }
            cachedValues.put(objName, values);
            cachedNames.put(objName, attrNames);
            return values;
View Full Code Here

        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) {
View Full Code Here

            MalformedObjectNameException {
        MBeanServer mbsc = MBeans.getMBeanServer();
        AttributeList 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 - openFdCount};
        addMetrics(list, fdMetrics, fdCounts, StandardUnit.Count);
    }
View Full Code Here

        String type = (String) handlerCtx.getInputValue("type");
        Map valueMap = new HashMap();
        try {
            String objectName = getJmsDestinationObjectName(SUBTYPE_CONFIG, name, type);
            AttributeList attributes = (AttributeList) JMXUtil.getMBeanServer().getAttributes(new ObjectName(objectName), ATTRS_CONFIG);
            for (Attribute attribute : attributes.asList()) {
                valueMap.put(attribute.getName(), (attribute.getValue() != null) ? attribute.getValue().toString() : null);
            }

            handlerCtx.setOutputValue("destData", valueMap);
        } catch (Exception ex) {
View Full Code Here

            String objectName = getJmsDestinationObjectName(SUBTYPE_MONITOR, name, type);
            AttributeList attributes = (AttributeList) getMBeanServerConnection(target).getAttributes(new ObjectName(objectName), ATTRS_MONITOR);
            ResourceBundle bundle = GuiUtil.getBundle("org.glassfish.jms.admingui.Strings");
            statsList.add(createRow("Name", name, ""));
            statsList.add(createRow("Type", type.substring(0, 1).toUpperCase() + type.substring(1), ""));
            for (Attribute attribute : attributes.asList()) {
                statsList.add(
                        createRow(
                        GuiUtil.getMessage(bundle, "jmsPhysDestinations." + attribute.getName()),
                        attribute.getValue(),
                        GuiUtil.getMessage(bundle, "jmsPhysDestinations." + attribute.getName() + "Help")));
View Full Code Here

        AttributeList attributeList =
                mBeanServer.getAttributes(objectName, attributeSet.toArray(new String[attributeSet.size()]));

        Map<String, Object> attributeValueMap = new TreeMap<String, Object>();
        for (Attribute attribute : attributeList.asList()) {
            attributeValueMap.put(attribute.getName(), sanitizer.escapeValue(attribute.getValue()));
        }

        return attributeValueMap;
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.