geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vamsavardhana Reddy" <>
Subject How to get memory statistics from a remote Geronimo runtime?
Date Mon, 03 Dec 2007 18:52:05 GMT
I am wondering if the following (which works) is the correct way to get
maxHeapSize and usedMemory from a remote Geronimo server.


        Map map = new HashMap();
        map.put("jmx.remote.credentials", new String[] {user, password});
        JMXServiceURL address = new JMXServiceURL(
                "service:jmx:rmi:///jndi/rmi://"+host+ ":" + port +
        JMXConnector jmxConnector = JMXConnectorFactory.connect(address,
        mbServerConnection = jmxConnector.getMBeanServerConnection();
        objName = ObjectName.getInstance
        Stats stats = (Stats) mbServerConnection.getAttribute(objName,
         BoundedRangeStatisticImpl statistic = (BoundedRangeStatisticImpl)
        long maxMemory = statistic.getUpperBound();
        long usedMemory = statistic.getCurrent();

Is this ok?  Or, is there a better way?


View raw message