Package com.googlecode.psiprobe.model.jmx

Examples of com.googlecode.psiprobe.model.jmx.MemoryPool


    public void collect() throws Exception {
        List pools = jvmMemoryInfoAccessor.getPools();
        long time = System.currentTimeMillis();
        for (Iterator it = pools.iterator(); it.hasNext(); ) {
            MemoryPool pool = (MemoryPool) it.next();
            buildAbsoluteStats("memory.pool."+pool.getName(), pool.getUsed(), time);
        }
    }
View Full Code Here


        long totalCommitted = 0;

        for (Iterator it = memoryOPools.iterator(); it.hasNext();) {
            ObjectInstance oi = (ObjectInstance) it.next();
            ObjectName oName = oi.getObjectName();
            MemoryPool memoryPool = new MemoryPool();
            memoryPool.setName(JmxTools.getStringAttr(mBeanServer, oName, "Name"));
            memoryPool.setType(JmxTools.getStringAttr(mBeanServer, oName, "Type"));

            CompositeDataSupport cd = (CompositeDataSupport) mBeanServer.getAttribute(oName, "Usage");
            //
            // It seems that "Usage" attribute of one of the pools may turn into null intermittently. We better have a
            // dip in the graph then an NPE though.
            //
            if (cd != null) {
                memoryPool.setMax(JmxTools.getLongAttr(cd, "max"));
                memoryPool.setUsed(JmxTools.getLongAttr(cd, "used"));
                memoryPool.setInit(JmxTools.getLongAttr(cd, "init"));
                memoryPool.setCommitted(JmxTools.getLongAttr(cd, "committed"));
            } else {
                logger.error("Oops, JVM problem? "+oName.toString()+" \"Usage\" attribute is NULL!");
            }

            totalInit += memoryPool.getInit();
            totalMax += memoryPool.getMax();
            totalUsed += memoryPool.getUsed();
            totalCommitted += memoryPool.getCommitted();

            memoryPools.add(memoryPool);
        }

        if (!memoryPools.isEmpty()) {
            MemoryPool pool = new MemoryPool();
            pool.setName("Total");
            pool.setType("TOTAL");
            pool.setInit(totalInit);
            pool.setUsed(totalUsed);
            pool.setMax(totalMax);
            pool.setCommitted(totalCommitted);
            memoryPools.add(pool);
        }

        return memoryPools;
View Full Code Here

TOP

Related Classes of com.googlecode.psiprobe.model.jmx.MemoryPool

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.