Commit 92dffe6c 92dffe6c25c977428455a36016a9706461b8b9ae by Christian Gerdes

Lagt till dumpAllMBeans()

1 parent d6ba81ae
......@@ -2,11 +2,15 @@ package se.lil.jm;
import java.io.IOException;
import java.net.MalformedURLException;
import java.util.Set;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
import javax.management.JMX;
import javax.management.MBeanAttributeInfo;
import javax.management.MBeanInfo;
import javax.management.MBeanServerConnection;
import javax.management.MalformedObjectNameException;
import javax.management.ObjectName;
import javax.management.remote.JMXConnector;
import javax.management.remote.JMXConnectorFactory;
......@@ -27,6 +31,29 @@ public class JmxMon {
int getDataCalls = 0;
int getDataSucess = 0;
public void dumpAllMBeans() {
dumpAllMBeans(null);
}
public void dumpAllMBeans(String query) {
if(mbsc != null) {
try {
Set<ObjectName> res = mbsc.queryNames(query != null ? new ObjectName(query) : ObjectName.WILDCARD, null);
for (ObjectName name : res) {
System.out.println(name.getCanonicalName());
MBeanInfo inf = mbsc.getMBeanInfo(name);
MBeanAttributeInfo[] attribs = inf.getAttributes();
for (MBeanAttributeInfo ainf : attribs) {
System.out.println("(" + ainf.getType() + ") " + ainf.getName());
}
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
public int getDataCalled() {
return getDataCalls;
}
......
......@@ -19,7 +19,8 @@ public class TestRunner {
Long ts1 = System.currentTimeMillis();
JmxMon mon1 = new JmxMon("service:jmx:iiop:///jndi/iiop://u01892.ef.kap.rsv.se:17020/weblogic.management.mbeanservers.runtime");
//JmxMon mon1 = new JmxMon("service:jmx:rmi:///jndi/iiop://u01892.ef.kap.rsv.se:17020/weblogic.management.mbeanservers.runtime");
JmxMon mon1 = new JmxMon("service:jmx:iiop:///jndi/iiop://u30009:26732/weblogic.management.mbeanservers.runtime");
mon1.open();
jmxList.add(mon1);
......@@ -30,7 +31,9 @@ public class TestRunner {
+ "\nTime: " + time + "ms\n"
);
int times = 3;
mon1.dumpAllMBeans("java.lang:*");
int times = 0;
while(times-- > 0) {
for(JmxMon mon : jmxList) {
ts1 = System.currentTimeMillis();
......