@Override
 public List<JobFeedbackPo> handle(ResultSet rs) throws SQLException {
   List<JobFeedbackPo> jobFeedbackPos = new ArrayList<JobFeedbackPo>();
   while (rs.next()) {
     JobFeedbackPo jobFeedbackPo = new JobFeedbackPo();
     jobFeedbackPo.setId(rs.getString("id"));
     jobFeedbackPo.setTaskTrackerJobResult(
         JSON.parse(
             rs.getString("job_result"), new TypeReference<TaskTrackerJobResult>() {}));
     jobFeedbackPo.setGmtCreated(rs.getLong("gmt_created"));
     jobFeedbackPos.add(jobFeedbackPo);
   }
   return jobFeedbackPos;
 }
 @Override
 public boolean add(List<JobFeedbackPo> jobFeedbackPos) {
   if (CollectionUtils.isEmpty(jobFeedbackPos)) {
     return true;
   }
   // insert ignore duplicate record
   Object[] params = new Object[2];
   for (JobFeedbackPo jobFeedbackPo : jobFeedbackPos) {
     params[0] = jobFeedbackPo.getGmtCreated();
     params[1] = JSON.toJSONString(jobFeedbackPo.getTaskTrackerJobResult());
     try {
       String jobClientNodeGroup =
           jobFeedbackPo.getTaskTrackerJobResult().getJobWrapper().getJob().getSubmitNodeGroup();
       getSqlTemplate().update(getRealSql(insertSQL, jobClientNodeGroup), params);
     } catch (SQLException e) {
       throw new JobQueueException(e);
     }
   }
   return true;
 }
예제 #3
0
 @Override
 public String toString() {
   return JSON.toJSONString(this);
 }