...
|
...
|
@@ -24,7 +24,7 @@ public class Connection { |
|
|
private MBeanServerConnection serverConnection;
|
|
|
private Map<String, ObjectInstance> beanMap = new HashMap<String, ObjectInstance>();
|
|
|
private DecimalFormat df = new DecimalFormat("0.00");
|
|
|
private JvmData jvmData=new JvmData();
|
|
|
private JvmData jvmData = new JvmData();
|
|
|
|
|
|
|
|
|
public Connection(final String rawUrl, final String hostName, final int port, final JMXServiceURL serviceURL, final String username,
|
...
|
...
|
@@ -46,6 +46,7 @@ public class Connection { |
|
|
serverConnector = JMXConnectorFactory.connect(this.serviceURL, envMap);
|
|
|
serverConnection = this.serverConnector.getMBeanServerConnection();
|
|
|
} catch (IOException e) {
|
|
|
System.out.println(e.getMessage());
|
|
|
disConnect();
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -86,8 +87,9 @@ public class Connection { |
|
|
ObjectInstance threadInstance = this.serverConnection.getObjectInstance(new ObjectName("java.lang:type=Threading"));
|
|
|
beanMap.put("thread", threadInstance);
|
|
|
|
|
|
|
|
|
//Memory Bean
|
|
|
ObjectInstance oldGenInstance = this.serverConnection.getObjectInstance(new ObjectName("java.lang:type=MemoryPool,name=PS Old Gen"));
|
|
|
ObjectInstance oldGenInstance = this.serverConnection.getObjectInstance(new ObjectName("java.lang:type=MemoryPool,name=CMS Old Gen"));
|
|
|
beanMap.put("oldGen", oldGenInstance);
|
|
|
}
|
|
|
|
...
|
...
|
@@ -122,6 +124,7 @@ public class Connection { |
|
|
jvmData.setThreadPeak(peak);
|
|
|
jvmData.setThreadCount(count);
|
|
|
} catch (IOException e) {
|
|
|
System.out.println(e.getMessage());
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -140,6 +143,7 @@ public class Connection { |
|
|
jvmData.setMaxOldGen(maxOldGenMemory);
|
|
|
|
|
|
} catch (IOException e) {
|
|
|
System.out.println(e.getMessage());
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -154,6 +158,7 @@ public class Connection { |
|
|
geThreadInfo();
|
|
|
return JSON.toJSONString(jvmData);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
System.exit(1);
|
|
|
} finally {
|
|
|
disConnect();
|
...
|
...
|
|