Examples of CompositeData


Examples of javax.management.openmbean.CompositeData

        if (threadID == -1 && threadName != null) {
            // find thread by name
            long[] allIds = (long[]) mBeanServer.getAttribute(threadingOName, "AllThreadIds");
            for (int i = 0; i < allIds.length; i++) {
                CompositeData cd = (CompositeData) mBeanServer.invoke(threadingOName, "getThreadInfo",
                        new Object[]{new Long(allIds[i])}, new String[] {"long"});
                String name = JmxTools.getStringAttr(cd, "threadName");
                if (threadName.equals(name)) {
                    threadID = allIds[i];
                    break;
                }
            }
        }

        if (mBeanServer.queryMBeans(threadingOName, null) != null && threadID != -1) {

            CompositeData cd = (CompositeData) mBeanServer.invoke(threadingOName, "getThreadInfo",
                    new Object[]{new Long(threadID), new Integer(stackElementCount)}, new String[] {"long", "int"});
            if (cd != null) {
                CompositeData[] elements = (CompositeData[]) cd.get("stackTrace");
                threadName = JmxTools.getStringAttr(cd, "threadName");

                stack = new ArrayList(elements.length);

                for (int i = 0; i < elements.length; i++) {
                    CompositeData cd2 = elements[i];
                    ThreadStackElement tse = new ThreadStackElement();
                    tse.setClassName(JmxTools.getStringAttr(cd2, "className"));
                    tse.setFileName(JmxTools.getStringAttr(cd2, "fileName"));
                    tse.setMethodName(JmxTools.getStringAttr(cd2, "methodName"));
                    tse.setLineNumber(JmxTools.getIntAttr(cd2, "lineNumber", -1));
View Full Code Here

Examples of javax.management.openmbean.CompositeData

        if (allIds != null) {
            threads = new ArrayList(allIds.length);

            for (int i = 0; i < allIds.length; i++) {
                CompositeData cd = (CompositeData) mBeanServer.invoke(threadingOName, "getThreadInfo",
                        new Object[]{new Long(allIds[i]), new Integer(executionStackDepth)}, new String[]{"long", "int"});

                if (cd != null) {
                    SunThread st = new SunThread();
                    st.setId(JmxTools.getLongAttr(cd, "threadId"));
                    st.setName(JmxTools.getStringAttr(cd, "threadName"));
                    st.setState(JmxTools.getStringAttr(cd, "threadState"));
                    st.setSuspended(JmxTools.getBooleanAttr(cd, "suspended"));
                    st.setInNative(JmxTools.getBooleanAttr(cd, "inNative"));
                    st.setLockName(JmxTools.getStringAttr(cd, "lockName"));
                    st.setLockOwnerName(JmxTools.getStringAttr(cd, "lockOwnerName"));
                    st.setWaitedCount(JmxTools.getLongAttr(cd, "waitedCount"));
                    st.setBlockedCount(JmxTools.getLongAttr(cd, "blockedCount"));
                    st.setDeadlocked(contains(deadlockedIds, st.getId()));

                    CompositeData[] stack = (CompositeData[]) cd.get("stackTrace");
                    if (stack.length > 0) {
                        CompositeData cd2 = stack[0];
                        ThreadStackElement tse = new ThreadStackElement();
                        tse.setClassName(JmxTools.getStringAttr(cd2, "className"));
                        tse.setFileName(JmxTools.getStringAttr(cd2, "fileName"));
                        tse.setMethodName(JmxTools.getStringAttr(cd2, "methodName"));
                        tse.setLineNumber(JmxTools.getIntAttr(cd2, "lineNumber", -1));
View Full Code Here

Examples of javax.management.openmbean.CompositeData

    // todo: is there a simpler way to get CompositeType (without getting the value)
    private CompositeType getCompositeType(ServerConnection connection,
                                           ObjectName objectName,
                                           ObjectAttributeInfo attrInfo){
        CompositeData compositeData =
                (CompositeData)connection.getAttribute(objectName, attrInfo.getName());
        return compositeData.getCompositeType();
    }
View Full Code Here

Examples of javax.management.openmbean.CompositeData

        attrList =
                connection.getAttributes(context.getObjectName(),
                        new String[]{attributeName});
        attrValue = (ObjectAttribute)attrList.get(0);
        if(attrValue.getStatus() == ObjectAttribute.STATUS_OK){
            CompositeData compositeData = (CompositeData)attrValue.getValue();
            attrValue = new ObjectAttribute(attribute,
                    compositeData.get(itemName));
        }
        return attrValue;
    }
View Full Code Here

Examples of javax.management.openmbean.CompositeData

                }
                Object output = connection.invoke(new ObjectName(idResolverMBean), idResolverOperation,
                        new Object[]{id}, new String[]{idType});
                if(idResolverName != null){
                    // if idResolverName is specified, output is a composite type
                    CompositeData compositeData = (CompositeData)output;
                    resolvedId = compositeData.get(idResolverName);
                }
            }
        }
        return resolvedId.toString();
    }
View Full Code Here

Examples of javax.management.openmbean.CompositeData

        this.compositeType = createCompositeType();
        this.tabularData = createTabularData();
    }
   
    public CompositeData createCompositeData(Object[] obj) throws Exception {
        CompositeData compData = new CompositeDataSupport(
                compositeType, itemNames, obj);
        return compData;
    }
View Full Code Here

Examples of javax.management.openmbean.CompositeData

            for (int i = 0; i < bundles.length; i++) {
                try {
                    Bundle bundle = bundles[i];
                    BundleInfo info = bundleService.getInfo(bundle);
                    String bundleStateString = info.getState().toString();
                    CompositeData data = new CompositeDataSupport(bundleType,
                            new String[]{"ID", "Name", "Version", "Start Level", "State"},
                            new Object[]{info.getBundleId(), info.getSymbolicName(), info.getVersion(), info.getStartLevel(), bundleStateString});
                    table.put(data);
                } catch (Exception e) {
                    LOG.error(e.getMessage(), e);
View Full Code Here

Examples of javax.management.openmbean.CompositeData

        JmxInstance ji = new JmxInstance(i);
        TabularData td = JmxInstance.tableFrom(Collections.singletonList(ji));       
        Collection<?> keys = (Collection<?>) td.keySet().iterator().next();
        Assert.assertEquals("MyInstance", keys.iterator().next());
       
        CompositeData cd = td.get(keys.toArray());
        Assert.assertEquals(1712, cd.get("Pid"));
        Assert.assertEquals("MyInstance", cd.get("Name"));
        Assert.assertEquals(true, cd.get("Is Root"));
        Assert.assertEquals(0, cd.get("SSH Port"));
        Assert.assertEquals(0, cd.get("RMI Port"));
        Assert.assertEquals("Started", cd.get("State"));
        Assert.assertNull(cd.get("Location"));
        Assert.assertNull(cd.get("JavaOpts"));
    }
View Full Code Here

Examples of javax.management.openmbean.CompositeData

        AdminServiceMBeanImpl ab = new AdminServiceMBeanImpl();
        ab.setAdminService(as);
       
        TabularData td = ab.getInstances();
        Assert.assertEquals(2, td.size());
        CompositeData cd1 = td.get(new Object [] {"i1"});
        Assert.assertTrue(cd1.containsValue("i1"));
        Assert.assertTrue(cd1.containsValue(true));
        Assert.assertTrue(cd1.containsValue(1234));
        Assert.assertTrue(cd1.containsValue(8818));
        Assert.assertTrue(cd1.containsValue(1122));
        Assert.assertTrue(cd1.containsValue("somewhere"));
        Assert.assertTrue(cd1.containsValue("someopts"));
        Assert.assertTrue(cd1.containsValue("Stopped"));

        CompositeData cd2 = td.get(new Object [] {"i2"});
        Assert.assertTrue(cd2.containsValue("i2"));
    }
View Full Code Here

Examples of javax.management.openmbean.CompositeData

            assertEquals("Wrong exchange type", "fanout", exchange.getExchangeType());
            TabularDataSupport bindings = (TabularDataSupport) exchange.bindings();
            assertEquals(1, bindings.size());
            for(Object o : bindings.values())
            {
                CompositeData binding = (CompositeData) o;

                String bindingKey = (String) binding.get(ManagedExchange.BINDING_KEY);
                String[] queueNames = (String[]) binding.get(ManagedExchange.QUEUE_NAMES);

                //Because its a fanout exchange, we just return a single '*' key with all bound queues
                assertEquals("unexpected binding key", "*", bindingKey);
                assertEquals("unexpected number of queues bound", 1, queueNames.length);
                assertEquals("unexpected queue name", QUEUE_WITH_DLQ_NAME + "_DLQ", queueNames[0]);
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.