Ejemplo n.º 1
0
 public JrdwMonitorVo toJrdwMonitor(int id, String jobId) throws Exception {
   JrdwMonitorVo jmv = new JrdwMonitorVo();
   jmv.setId(id);
   jmv.setJrdw_mark(jobId);
   // pack the member / value  to the Map<String,String> or Map<String,Long>
   Map<String, Long> content = new HashMap<String, Long>();
   switch (id) {
     case JDMysqlTrackerPhenix.FETCH_MONITOR:
       content.put(JDMysqlTrackerPhenix.FETCH_ROWS, fetchNum);
       content.put(JDMysqlTrackerPhenix.FETCH_SIZE, batchSize);
       break;
     case JDMysqlTrackerPhenix.PERSIS_MONITOR:
       content.put(JDMysqlTrackerPhenix.SEND_ROWS, persisNum);
       content.put(JDMysqlTrackerPhenix.SEND_SIZE, batchSize);
       content.put(JDMysqlTrackerPhenix.SEND_TIME, (sendEnd - sendStart));
       content.put(JDMysqlTrackerPhenix.DELAY_TIME, delayTime);
       break;
     default:
       break;
   }
   // map to json
   JSONObject jo = JSONConvert.MapToJson(content);
   jmv.setContent(jo.toString());
   return jmv;
 }
Ejemplo n.º 2
0
 public JrdwMonitorVo toJrdwMonitorOnline(int id, String jobId) throws Exception {
   JrdwMonitorVo jmv = new JrdwMonitorVo();
   jmv.setId(id);
   jmv.setJrdw_mark(jobId);
   // pack the member / value  to the Map<String,String> or Map<String,Long>
   Map<String, Long> content = new HashMap<String, Long>();
   Map<String, String> msgContent = new HashMap<String, String>();
   Map<String, String> IPContent = new HashMap<String, String>();
   Map<String, Object> newContent = new HashMap<String, Object>();
   JSONObject jo;
   switch (id) {
     case JDMysqlTrackerMonitorType.FETCH_MONITOR:
       newContent.put(JDMysqlTrackerMonitorType.FETCH_ROWS, fetchNum);
       newContent.put(JDMysqlTrackerMonitorType.FETCH_SIZE, batchSize);
       newContent.put(JDMysqlTrackerMonitorType.DELAY_NUM, delayNum);
       jo = JSONConvert.MapToJson(newContent);
       break;
     case JDMysqlTrackerMonitorType.PERSIS_MONITOR:
       content.put(JDMysqlTrackerPhenix.SEND_ROWS, persisNum);
       content.put(JDMysqlTrackerPhenix.SEND_SIZE, batchSize);
       content.put(JDMysqlTrackerPhenix.SEND_TIME, (sendEnd - sendStart));
       content.put(JDMysqlTrackerPhenix.DELAY_TIME, delayTime);
       jo = JSONConvert.MapToJson(content);
       break;
     case JDMysqlTrackerMonitorType.EXCEPTION_MONITOR:
       msgContent.put(JDMysqlTrackerMonitorType.EXCEPTION, exMsg);
       jo = JSONConvert.MapToJson(msgContent);
       break;
     case JDMysqlTrackerMonitorType.IP_MONITOR:
       IPContent.put(JDMysqlTrackerMonitorType.IP, ip);
       jo = JSONConvert.MapToJson(IPContent);
       break;
     default:
       jo = new JSONObject();
       break;
   }
   // map to json
   jmv.setContent(jo.toString());
   return jmv;
 }