📄 attributesutil.java
字号:
//import javax.management.ObjectName;
import org.json.simple.JSONArray;
public class AttributesUtil {
//Attributes' names
public final static String WS_CPU_USAGE = "CPUUSAGE";
public final static String WS_IP_ADDRESS = "IPADDRESS";
public final static String WS_THREAD_ACTIVE_NUMS = "THREADACTIVENUMS";
public final static String WS_THREAD_DESTROY_NUMS = "THREADDESTROYNUMS";
public final static String WS_JVM_RUN_TIME = "JVMRUNTIME";
public final static String WS_FAULT_JDBCCONN_NUMS = "FAULTJDBCCONNNUMS";
public final static String WS_JDBCCONN_TIME = "JDBCCONNTIME";
public final static String WS_OBJECT_NUMS="NEWOBJECTNUMS";
//attributes' descriptions
public final static String WS_CPU_USAGE_DESP = "The average CPU utilization since the server was started";
public final static String WS_IP_ADDRESS_DESP = "IP address of the given host";
public final static String WS_THREAD_ACTIVE_NUMS_DESP = "Total number of concurrently active threads";
public final static String WS_THREAD_DESTROY_NUMS_DESP = "Total number of threads that are destroyed";
public final static String WS_JVM_RUN_TIME_DESP = "The amount of time (ms) the JVM is running";
public final static String WS_FAULT_JDBCCONN_NUMS_DESP = "The number of connection timeouts in the pool";
public final static String WS_JDBCCONN_TIME_DESP = "The amount of time in milliseconds spent executing in the JDBC driver";
public final static String WS_OBJECT_NUMS_DESP="The number of new objects created by the object pool";
public static JSONArray getAttributesArray(WSConfigManagement ws) {
JSONArray jsonArray = new JSONArray();
jsonArray.add(getCpuUsage(ws));
jsonArray.add(getIpAddress(ws));
jsonArray.add(getThreadActiveNums(ws));
jsonArray.add(getThreadDestroyNums(ws));
jsonArray.add(getJVMRunTime(ws));
jsonArray.add(getFaultJDBCConnNums(ws));
jsonArray.add(getJDBCConnTime(ws));
jsonArray.add(getObjectNums(ws));
return jsonArray;
}
public static JSONArray getCpuUsage(WSConfigManagement ws) {
JSONArray cpuUsage = new JSONArray();
cpuUsage.add(WS_CPU_USAGE);
cpuUsage.add(ws.getCPUUsage());
cpuUsage.add(WS_CPU_USAGE_DESP);
return cpuUsage;
}
public static JSONArray getIpAddress(WSConfigManagement ws) {
JSONArray ipAddress = new JSONArray();
ipAddress.add(WS_IP_ADDRESS);
ipAddress.add(ws.getIpAddress());
ipAddress.add(WS_IP_ADDRESS_DESP);
return ipAddress;
}
public static JSONArray getThreadActiveNums(WSConfigManagement ws) {
JSONArray threadActiveNums = new JSONArray();
threadActiveNums.add(WS_THREAD_ACTIVE_NUMS);
threadActiveNums.add(ws.getThreadActiveNums());
threadActiveNums.add(WS_THREAD_ACTIVE_NUMS_DESP);
return threadActiveNums;
}
public static JSONArray getThreadDestroyNums(WSConfigManagement ws) {
JSONArray threadDestroyNums = new JSONArray();
threadDestroyNums.add(WS_THREAD_DESTROY_NUMS);
threadDestroyNums.add(ws.getThreadDestroyNums());
threadDestroyNums.add(WS_THREAD_DESTROY_NUMS_DESP);
return threadDestroyNums;
}
public static JSONArray getJVMRunTime(WSConfigManagement ws) {
JSONArray jvmRunTime = new JSONArray();
jvmRunTime.add(WS_JVM_RUN_TIME);
jvmRunTime.add(ws.getJVMRunTime());
jvmRunTime.add(WS_JVM_RUN_TIME_DESP);
return jvmRunTime;
}
public static JSONArray getFaultJDBCConnNums(WSConfigManagement ws) {
JSONArray faultJDBCConnNums = new JSONArray();
faultJDBCConnNums.add(WS_FAULT_JDBCCONN_NUMS);
faultJDBCConnNums.add(ws.getFaultJDBCConnNums());
faultJDBCConnNums.add(WS_FAULT_JDBCCONN_NUMS_DESP);
return faultJDBCConnNums;
}
public static JSONArray getJDBCConnTime(WSConfigManagement ws) {
JSONArray jdbcConnTime = new JSONArray();
jdbcConnTime.add(WS_JDBCCONN_TIME);
jdbcConnTime.add(ws.getJDBCConnTime());
jdbcConnTime.add(WS_JDBCCONN_TIME_DESP);
return jdbcConnTime;
}
public static JSONArray getObjectNums(WSConfigManagement ws){
JSONArray objectNums=new JSONArray();
objectNums.add(WS_OBJECT_NUMS);
objectNums.add(ws.getNewObjectByPool());
objectNums.add(WS_OBJECT_NUMS_DESP);
return objectNums;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -