Example #1
0
  @RequestMapping("/loadRuntimeInfo")
  @ResponseBody
  public JSONObject doLoadRuntimeInfo(HttpServletRequest request) {
    try {
      String app = request.getParameter("app");
      RuntimeMXBean mBean = JMConnManager.getRuntimeMBean(app);
      ClassLoadingMXBean cBean = JMConnManager.getClassMbean(app);
      Map<String, String> props = mBean.getSystemProperties();
      DateFormat format = DateFormat.getInstance();
      List<String> input = mBean.getInputArguments();
      Date date = new Date(mBean.getStartTime());

      TreeMap<String, Object> data = new TreeMap<String, Object>();

      data.put("apppid", mBean.getName());
      data.put("startparam", input.toString());
      data.put("starttime", format.format(date));
      data.put("classLoadedNow", cBean.getLoadedClassCount());
      data.put("classUnloadedAll", cBean.getUnloadedClassCount());
      data.put("classLoadedAll", cBean.getTotalLoadedClassCount());
      data.putAll(props);

      JSONObject json = new JSONObject(true);
      json.putAll(data);
      return json;
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
  }
Example #2
0
 private static JSONArray getSubJsonArray(SataList list) {
   JSONArray array = new JSONArray();
   for (int i = 0; i < list.size(); i++) {
     SataMap sataMap = list.getSataMap(i);
     JSONObject jsonObject = new JSONObject();
     jsonObject.putAll(sataMap2JSON(sataMap));
     array.add(jsonObject);
   }
   return array;
 }