|
@@ -1,94 +0,0 @@
|
1
|
|
-package com.xxl.job.admin.core.jobbean;
|
2
|
|
-//package com.xxl.job.action.job;
|
3
|
|
-//
|
4
|
|
-//import java.io.PrintWriter;
|
5
|
|
-//import java.io.StringWriter;
|
6
|
|
-//import java.util.Date;
|
7
|
|
-//import java.util.HashMap;
|
8
|
|
-//import java.util.Map;
|
9
|
|
-//
|
10
|
|
-//import org.apache.commons.lang.StringUtils;
|
11
|
|
-//import org.quartz.JobExecutionContext;
|
12
|
|
-//import org.quartz.JobExecutionException;
|
13
|
|
-//import org.quartz.JobKey;
|
14
|
|
-//import org.slf4j.Logger;
|
15
|
|
-//import org.slf4j.LoggerFactory;
|
16
|
|
-//import org.springframework.scheduling.quartz.QuartzJobBean;
|
17
|
|
-//
|
18
|
|
-//import com.xxl.job.client.handler.HandlerRouter;
|
19
|
|
-//import com.xxl.job.client.util.XxlJobNetCommUtil.RemoteCallBack;
|
20
|
|
-//import com.xxl.job.client.util.JacksonUtil;
|
21
|
|
-//import com.xxl.job.core.model.XxlJobInfo;
|
22
|
|
-//import com.xxl.job.core.model.XxlJobLog;
|
23
|
|
-//import com.xxl.job.core.thread.JobFailMonitorHelper;
|
24
|
|
-//import com.xxl.job.core.util.DynamicSchedulerUtil;
|
25
|
|
-//
|
26
|
|
-///**
|
27
|
|
-// * http job bean
|
28
|
|
-// * @author xuxueli 2015-12-17 18:20:34
|
29
|
|
-// */
|
30
|
|
-//@Deprecated
|
31
|
|
-//public abstract class LocalNomalJobBean extends QuartzJobBean {
|
32
|
|
-// private static Logger logger = LoggerFactory.getLogger(LocalNomalJobBean.class);
|
33
|
|
-//
|
34
|
|
-// @Override
|
35
|
|
-// protected void executeInternal(JobExecutionContext context)
|
36
|
|
-// throws JobExecutionException {
|
37
|
|
-// JobKey jobKey = context.getTrigger().getJobKey();
|
38
|
|
-//
|
39
|
|
-// XxlJobInfo jobInfo = DynamicSchedulerUtil.xxlJobInfoDao.load(jobKey.getGroup(), jobKey.getName());
|
40
|
|
-// @SuppressWarnings("unchecked")
|
41
|
|
-// HashMap<String, String> jobDataMap = (HashMap<String, String>) JacksonUtil.readValueRefer(jobInfo.getJobData(), Map.class);
|
42
|
|
-//
|
43
|
|
-// // save log
|
44
|
|
-// XxlJobLog jobLog = new XxlJobLog();
|
45
|
|
-// jobLog.setJobGroup(jobInfo.getJobGroup());
|
46
|
|
-// jobLog.setJobName(jobInfo.getJobName());
|
47
|
|
-// jobLog.setJobCron(jobInfo.getJobCron());
|
48
|
|
-// jobLog.setJobDesc(jobInfo.getJobDesc());
|
49
|
|
-// jobLog.setJobClass(jobInfo.getJobClass());
|
50
|
|
-// jobLog.setJobData(jobInfo.getJobData());
|
51
|
|
-//
|
52
|
|
-// jobLog.setJobClass(RemoteHttpJobBean.class.getName());
|
53
|
|
-// jobLog.setJobData(jobInfo.getJobData());
|
54
|
|
-// DynamicSchedulerUtil.xxlJobLogDao.save(jobLog);
|
55
|
|
-// logger.info(">>>>>>>>>>> xxl-job trigger start, jobLog:{}", jobLog);
|
56
|
|
-//
|
57
|
|
-// // trigger request
|
58
|
|
-// String handler_params = jobDataMap.get(HandlerRouter.HANDLER_PARAMS);
|
59
|
|
-// String[] handlerParams = null;
|
60
|
|
-// if (StringUtils.isNotBlank(handler_params)) {
|
61
|
|
-// handlerParams = handler_params.split(",");
|
62
|
|
-// }
|
63
|
|
-//
|
64
|
|
-// jobLog.setTriggerTime(new Date());
|
65
|
|
-// jobLog.setTriggerStatus(RemoteCallBack.SUCCESS);
|
66
|
|
-// jobLog.setTriggerMsg(null);
|
67
|
|
-//
|
68
|
|
-// try {
|
69
|
|
-// Object responseMsg = this.handle(handlerParams);
|
70
|
|
-//
|
71
|
|
-// jobLog.setHandleTime(new Date());
|
72
|
|
-// jobLog.setHandleStatus(RemoteCallBack.SUCCESS);
|
73
|
|
-// jobLog.setHandleMsg(JacksonUtil.writeValueAsString(responseMsg));
|
74
|
|
-// } catch (Exception e) {
|
75
|
|
-// logger.info("JobThread Exception:", e);
|
76
|
|
-// StringWriter out = new StringWriter();
|
77
|
|
-// e.printStackTrace(new PrintWriter(out));
|
78
|
|
-//
|
79
|
|
-// jobLog.setHandleTime(new Date());
|
80
|
|
-// jobLog.setHandleStatus(RemoteCallBack.FAIL);
|
81
|
|
-// jobLog.setHandleMsg(out.toString());
|
82
|
|
-// }
|
83
|
|
-//
|
84
|
|
-// // update trigger info
|
85
|
|
-// DynamicSchedulerUtil.xxlJobLogDao.updateTriggerInfo(jobLog);
|
86
|
|
-// DynamicSchedulerUtil.xxlJobLogDao.updateHandleInfo(jobLog);
|
87
|
|
-// JobFailMonitorHelper.monitor(jobLog.getId());
|
88
|
|
-// logger.info(">>>>>>>>>>> xxl-job trigger end, jobLog.id:{}, jobLog:{}", jobLog.getId(), jobLog);
|
89
|
|
-//
|
90
|
|
-// }
|
91
|
|
-//
|
92
|
|
-// public abstract Object handle(String... param);
|
93
|
|
-//
|
94
|
|
-//}
|