浏览代码

执行器策略推送

xueli.xue 8 年前
父节点
当前提交
177ab8d21e

+ 1 - 1
README.md 查看文件

@@ -737,7 +737,7 @@ Tips: 历史版本(V1.3.x)目前已经Release至稳定版本, 进入维护阶段
737 737
 - 3、CleanCode,清理无效的历史参数;
738 738
 - 4、规范系统配置数据,通过配置文件统一管理;
739 739
 - 5、执行器支持手动设置执行地址列表,提供开关切换使用注册地址还是手动设置的地址;
740
-- 6、执行器路由规则:第一个、循环、随机、顺序故障(默认)转移;
740
+- 6、执行器路由规则:第一个、最后一个、轮询、随机、一致性HASH、最不经常使用、最近最久未使用、故障转移;
741 741
 - 7、底层扩展数据接口调整;
742 742
 - 8、新建任务默认为非运行状态;
743 743
 

+ 1 - 1
db/tables_xxl_job.sql 查看文件

@@ -154,7 +154,7 @@ CREATE TABLE `XXL_JOB_QRTZ_TRIGGER_INFO` (
154 154
   `update_time` datetime DEFAULT NULL,
155 155
   `author` varchar(64) DEFAULT NULL COMMENT '作者',
156 156
   `alarm_email` varchar(255) DEFAULT NULL COMMENT '报警邮件',
157
-  `executor_route_strategy` varchar(20) DEFAULT NULL COMMENT '执行器路由策略',
157
+  `executor_route_strategy` varchar(50) DEFAULT NULL COMMENT '执行器路由策略',
158 158
   `executor_handler` varchar(255) DEFAULT NULL COMMENT '执行器任务handler',
159 159
   `executor_param` varchar(255) DEFAULT NULL COMMENT '执行器任务参数',
160 160
   `glue_switch` int(11) DEFAULT '0' COMMENT 'GLUE模式开关:0-否,1-是',

+ 138 - 102
xxl-job-admin/src/main/java/com/xxl/job/admin/core/jobbean/RemoteHttpJobBean.java 查看文件

@@ -3,6 +3,7 @@ package com.xxl.job.admin.core.jobbean;
3 3
 import com.xxl.job.admin.core.model.XxlJobGroup;
4 4
 import com.xxl.job.admin.core.model.XxlJobInfo;
5 5
 import com.xxl.job.admin.core.model.XxlJobLog;
6
+import com.xxl.job.admin.core.route.ExecutorRouteStrategyEnum;
6 7
 import com.xxl.job.admin.core.schedule.XxlJobDynamicScheduler;
7 8
 import com.xxl.job.admin.core.thread.JobMonitorHelper;
8 9
 import com.xxl.job.admin.core.thread.JobRegistryHelper;
@@ -11,6 +12,7 @@ import com.xxl.job.core.biz.model.ReturnT;
11 12
 import com.xxl.job.core.biz.model.TriggerParam;
12 13
 import com.xxl.job.core.registry.RegistHelper;
13 14
 import com.xxl.job.core.rpc.netcom.NetComClientProxy;
15
+import org.apache.commons.collections.CollectionUtils;
14 16
 import org.apache.commons.lang.StringUtils;
15 17
 import org.quartz.JobExecutionContext;
16 18
 import org.quartz.JobExecutionException;
@@ -19,7 +21,6 @@ import org.slf4j.Logger;
19 21
 import org.slf4j.LoggerFactory;
20 22
 import org.springframework.scheduling.quartz.QuartzJobBean;
21 23
 
22
-import java.text.MessageFormat;
23 24
 import java.util.*;
24 25
 
25 26
 /**
@@ -34,26 +35,23 @@ public class RemoteHttpJobBean extends QuartzJobBean {
34 35
 	@Override
35 36
 	protected void executeInternal(JobExecutionContext context)
36 37
 			throws JobExecutionException {
38
+
39
+		// load job
37 40
 		JobKey jobKey = context.getTrigger().getJobKey();
38 41
 		Integer jobId = Integer.valueOf(jobKey.getName());
39 42
 		XxlJobInfo jobInfo = XxlJobDynamicScheduler.xxlJobInfoDao.loadById(jobId);
40 43
 
41
-		// save log
44
+		// log part-1
42 45
 		XxlJobLog jobLog = new XxlJobLog();
43 46
 		jobLog.setJobGroup(jobInfo.getJobGroup());
44 47
 		jobLog.setJobId(jobInfo.getId());
45 48
 		XxlJobDynamicScheduler.xxlJobLogDao.save(jobLog);
46 49
 		logger.debug(">>>>>>>>>>> xxl-job trigger start, jobId:{}", jobLog.getId());
47 50
 
48
-        // admin address
49
-        List<String> adminAddressList = JobRegistryHelper.discover(RegistHelper.RegistType.ADMIN.name(), RegistHelper.RegistType.ADMIN.name());
50
-		Set<String> adminAddressSet = new HashSet<String>();
51
-        if (adminAddressList!=null) {
52
-            adminAddressSet.addAll(adminAddressList);
53
-        }
54
-        adminAddressSet.add(XxlJobDynamicScheduler.getCallbackAddress());
55
-
56
-		// update trigger info 1/2
51
+		// log part-2 param
52
+		//jobLog.setExecutorAddress(executorAddress);
53
+		jobLog.setExecutorHandler(jobInfo.getExecutorHandler());
54
+		jobLog.setExecutorParam(jobInfo.getExecutorParam());
57 55
 		jobLog.setTriggerTime(new Date());
58 56
 
59 57
 		// trigger request
@@ -64,114 +62,152 @@ public class RemoteHttpJobBean extends QuartzJobBean {
64 62
 		triggerParam.setGlueSwitch((jobInfo.getGlueSwitch()==0)?false:true);
65 63
 		triggerParam.setLogId(jobLog.getId());
66 64
 		triggerParam.setLogDateTim(jobLog.getTriggerTime().getTime());
67
-		triggerParam.setLogAddress(adminAddressSet);
68
-
69
-		// parse address
70
-		String groupAddressInfo = "注册方式:";
71
-		List<String> addressList = new ArrayList<String>();
72
-		XxlJobGroup group = XxlJobDynamicScheduler.xxlJobGroupDao.load(Integer.valueOf(jobInfo.getJobGroup()));
73
-		if (group!=null) {
74
-			if (group.getAddressType() == 0) {
75
-				groupAddressInfo += "自动注册";
76
-				addressList = JobRegistryHelper.discover(RegistHelper.RegistType.EXECUTOR.name(), group.getAppName());
77
-			} else {
78
-				groupAddressInfo += "手动录入";
79
-				if (StringUtils.isNotBlank(group.getAddressList())) {
80
-					addressList = Arrays.asList(group.getAddressList().split(","));
81
-				}
82
-			}
83
-			groupAddressInfo += ",地址列表:" + addressList.toString();
84
-		}
85
-        groupAddressInfo += "<br><br>";
65
+		triggerParam.setLogAddress(findCallbackAddressList());		// callback address list
86 66
 
87
-		// failover trigger
88
-		ReturnT<String> triggerResult = failoverTrigger(addressList, triggerParam, jobLog);
89
-		jobLog.setExecutorHandler(jobInfo.getExecutorHandler());
90
-		jobLog.setExecutorParam(jobInfo.getExecutorParam());
91
-		logger.info(">>>>>>>>>>> xxl-job failoverTrigger, jobId:{}, triggerResult:{}", jobLog.getId(), triggerResult.toString());
92
-		
93
-		// update trigger info 2/2
67
+		// do trigger
68
+		ReturnT<String> triggerResult = doTrigger(triggerParam, jobInfo, jobLog);
69
+
70
+		// log part-2
94 71
 		jobLog.setTriggerCode(triggerResult.getCode());
95
-		jobLog.setTriggerMsg(groupAddressInfo + triggerResult.getMsg());
72
+		jobLog.setTriggerMsg(triggerResult.getMsg());
96 73
 		XxlJobDynamicScheduler.xxlJobLogDao.updateTriggerInfo(jobLog);
97 74
 
98 75
 		// monitor triger
99 76
 		JobMonitorHelper.monitor(jobLog.getId());
100
-		
101 77
 		logger.debug(">>>>>>>>>>> xxl-job trigger end, jobId:{}", jobLog.getId());
102 78
     }
103
-	
104
-	
105
-	/**
106
-	 * failover for trigger remote address
107
-	 * @return
108
-	 */
109
-	public ReturnT<String> failoverTrigger(List<String> addressList, TriggerParam triggerParam, XxlJobLog jobLog){
110
-		 if (addressList==null || addressList.size() < 1) {
111
-			 return new ReturnT<String>(ReturnT.FAIL_CODE, "Trigger error, <br>>>>[address] is null <br><hr>");
112
-		} else if (addressList.size() == 1) {
113
-			 String address = addressList.get(0);
114
-			 // store real address
115
-			 jobLog.setExecutorAddress(address);
116
-
117
-			 // real trigger
118
-			 ExecutorBiz executorBiz = null;
119
-			 try {
120
-				 executorBiz = (ExecutorBiz) new NetComClientProxy(ExecutorBiz.class, address).getObject();
121
-			 } catch (Exception e) {
122
-				 e.printStackTrace();
123
-				 return new ReturnT<String>(ReturnT.FAIL_CODE, e.getMessage());
124
-			 }
125
-			 ReturnT<String> runResult = executorBiz.run(triggerParam);
126
-
127
-			 String failoverMessage = MessageFormat.format("Trigger running, <br>>>>[address] : {0}, <br>>>>[code] : {1}, <br>>>>[msg] : {2} <br><hr>",
128
-					 address, runResult.getCode(), runResult.getMsg());
129
-			 runResult.setMsg(runResult.getMsg() + failoverMessage);
130
-			 return runResult;
131
-		 } else {
132
-			
133
-			// for ha
134
-			Collections.shuffle(addressList);
135
-
136
-			// for failover
137
-			String failoverMessage = "";
138
-			for (String address : addressList) {
139
-				if (StringUtils.isNotBlank(address)) {
140
-
141
-
142
-                    ExecutorBiz executorBiz = null;
143
-                    try {
144
-                        executorBiz = (ExecutorBiz) new NetComClientProxy(ExecutorBiz.class, address).getObject();
145
-                    } catch (Exception e) {
146
-                        e.printStackTrace();
147
-                        return new ReturnT<String>(ReturnT.FAIL_CODE, e.getMessage());
148
-                    }
149
-
150
-                    // beat check
151
-					ReturnT<String> beatResult = executorBiz.beat();
152
-					failoverMessage += MessageFormat.format("BEAT running, <br>>>>[address] : {0}, <br>>>>[code] : {1}, <br>>>>[msg] : {2} <br><hr>",
153
-							address, beatResult.getCode(), beatResult.getMsg());
154
-
155
-					// beat success, trigger do
79
+
80
+    public ReturnT<String> doTrigger(TriggerParam triggerParam, XxlJobInfo jobInfo, XxlJobLog jobLog){
81
+		StringBuffer triggerSb = new StringBuffer();
82
+
83
+		// exerutor address list
84
+		ArrayList<String> addressList = null;
85
+		XxlJobGroup group = XxlJobDynamicScheduler.xxlJobGroupDao.load(jobInfo.getJobGroup());
86
+		if (group.getAddressType() == 0) {
87
+			triggerSb.append("注册方式:自动注册");
88
+			addressList = (ArrayList<String>) JobRegistryHelper.discover(RegistHelper.RegistType.EXECUTOR.name(), group.getAppName());
89
+		} else {
90
+			triggerSb.append("注册方式:手动录入");
91
+			if (StringUtils.isNotBlank(group.getAddressList())) {
92
+				addressList = new ArrayList<String>(Arrays.asList(group.getAddressList().split(",")));
93
+			}
94
+		}
95
+		triggerSb.append("<br>地址列表:").append(addressList!=null?addressList.toString():"");
96
+		if (CollectionUtils.isEmpty(addressList)) {
97
+			triggerSb.append("<hr>调度失败:").append("执行器地址为空");
98
+			return new ReturnT<String>(ReturnT.FAIL_CODE, triggerSb.toString());
99
+		}
100
+
101
+		// trigger remote executor
102
+		if (addressList.size() == 1) {
103
+			String address = addressList.get(0);
104
+			jobLog.setExecutorAddress(address);
105
+
106
+			ReturnT<String> runResult = runExecutor(triggerParam, address);
107
+			triggerSb.append("<hr>").append(runResult.getMsg());
108
+
109
+			return new ReturnT<String>(runResult.getCode(), triggerSb.toString());
110
+		} else {
111
+			// executor route strategy
112
+			ExecutorRouteStrategyEnum executorRouteStrategyEnum = ExecutorRouteStrategyEnum.match(jobInfo.getExecutorRouteStrategy(), null);
113
+			triggerSb.append("<br>路由策略:").append(executorRouteStrategyEnum!=null?(executorRouteStrategyEnum.name() + "-" + executorRouteStrategyEnum.getTitle()):null);
114
+			if (executorRouteStrategyEnum == null) {
115
+				triggerSb.append("<hr>调度失败:").append("执行器路由策略为空");
116
+				return new ReturnT<String>(ReturnT.FAIL_CODE, triggerSb.toString());
117
+			}
118
+
119
+			if (executorRouteStrategyEnum != ExecutorRouteStrategyEnum.FAILOVER) {
120
+				// get address
121
+				String address = executorRouteStrategyEnum.getRouter().route(jobInfo.getId(), addressList);
122
+				jobLog.setExecutorAddress(address);
123
+
124
+				// run
125
+				ReturnT<String> runResult = runExecutor(triggerParam, address);
126
+				triggerSb.append("<hr>").append(runResult.getMsg());
127
+
128
+				return new ReturnT<String>(runResult.getCode(), triggerSb.toString());
129
+			} else {
130
+				for (String address : addressList) {
131
+					// beat
132
+					ReturnT<String> beatResult = beatExecutor(address);
133
+					triggerSb.append("<hr>").append(beatResult.getMsg());
134
+
156 135
 					if (beatResult.getCode() == ReturnT.SUCCESS_CODE) {
157
-						// store real address
158 136
 						jobLog.setExecutorAddress(address);
159 137
 
160
-						// real trigger
161
-						ReturnT<String> runResult = executorBiz.run(triggerParam);
138
+						ReturnT<String> runResult = runExecutor(triggerParam, address);
139
+						triggerSb.append("<hr>").append(runResult.getMsg());
162 140
 
163
-						failoverMessage += MessageFormat.format("Trigger running, <br>>>>[address] : {0}, <br>>>>[status] : {1}, <br>>>>[msg] : {2} <br><hr>",
164
-								address, runResult.getCode(), runResult.getMsg());
165
-						runResult.setMsg( runResult.getMsg() + failoverMessage);
166
-						return runResult;
141
+						return new ReturnT<String>(runResult.getCode(), triggerSb.toString());
167 142
 					}
168
-
169 143
 				}
144
+				return new ReturnT<String>(ReturnT.FAIL_CODE, triggerSb.toString());
170 145
 			}
146
+		}
147
+	}
148
+
149
+	/**
150
+	 * run executor
151
+	 * @param address
152
+	 * @return
153
+	 */
154
+	public ReturnT<String> beatExecutor(String address){
155
+		ReturnT<String> beatResult = null;
156
+		try {
157
+			ExecutorBiz executorBiz = (ExecutorBiz) new NetComClientProxy(ExecutorBiz.class, address).getObject();
158
+			beatResult = executorBiz.beat();
159
+		} catch (Exception e) {
160
+			logger.error("", e);
161
+			beatResult = new ReturnT<String>(ReturnT.FAIL_CODE, ""+e );
162
+		}
163
+
164
+		StringBuffer sb = new StringBuffer("心跳检测:");
165
+		sb.append("<br>address:").append(address);
166
+		sb.append("<br>code:").append(beatResult.getCode());
167
+		sb.append("<br>msg:").append(beatResult.getMsg());
168
+		beatResult.setMsg(sb.toString());
169
+
170
+		return beatResult;
171
+	}
172
+
173
+	/**
174
+	 * run executor
175
+	 * @param triggerParam
176
+	 * @param address
177
+	 * @return
178
+	 */
179
+	public ReturnT<String> runExecutor(TriggerParam triggerParam, String address){
180
+		ReturnT<String> runResult = null;
181
+		try {
182
+			ExecutorBiz executorBiz = (ExecutorBiz) new NetComClientProxy(ExecutorBiz.class, address).getObject();
183
+			runResult = executorBiz.run(triggerParam);
184
+		} catch (Exception e) {
185
+			logger.error("", e);
186
+			runResult = new ReturnT<String>(ReturnT.FAIL_CODE, ""+e );
187
+		}
188
+
189
+		StringBuffer sb = new StringBuffer("触发调度:");
190
+		sb.append("<br>address:").append(address);
191
+		sb.append("<br>code:").append(runResult.getCode());
192
+		sb.append("<br>msg:").append(runResult.getMsg());
193
+		runResult.setMsg(sb.toString());
194
+
195
+		return runResult;
196
+	}
197
+
198
+	/**
199
+	 * find callback address list
200
+	 * @return
201
+	 */
202
+	public Set<String> findCallbackAddressList(){
203
+		Set<String> adminAddressSet = new HashSet<String>();
204
+		adminAddressSet.add(XxlJobDynamicScheduler.getCallbackAddress());
171 205
 
172
-			return new ReturnT<String>(ReturnT.FAIL_CODE, failoverMessage);
206
+		List<String> adminAddressList = JobRegistryHelper.discover(RegistHelper.RegistType.ADMIN.name(), RegistHelper.RegistType.ADMIN.name());
207
+		if (adminAddressList!=null) {
208
+			adminAddressSet.addAll(adminAddressList);
173 209
 		}
210
+		return adminAddressSet;
174 211
 	}
175 212
 
176
-	
177 213
 }

+ 1 - 0
xxl-job-admin/src/main/java/com/xxl/job/admin/core/route/strategy/ExecutorRouteRandom.java 查看文件

@@ -14,6 +14,7 @@ public class ExecutorRouteRandom extends ExecutorRouter {
14 14
 
15 15
     @Override
16 16
     public String route(int jobId, ArrayList<String> addressList) {
17
+        // Collections.shuffle(addressList);
17 18
         return addressList.get(localRandom.nextInt(addressList.size()));
18 19
     }
19 20
 

+ 2 - 0
xxl-job-admin/src/main/java/com/xxl/job/admin/dao/IXxlJobLogDao.java 查看文件

@@ -17,7 +17,9 @@ public interface IXxlJobLogDao {
17 17
 	public XxlJobLog load(int id);
18 18
 
19 19
 	public int save(XxlJobLog xxlJobLog);
20
+
20 21
 	public int updateTriggerInfo(XxlJobLog xxlJobLog);
22
+
21 23
 	public int updateHandleInfo(XxlJobLog xxlJobLog);
22 24
 	
23 25
 	public int delete(int jobId);

+ 1 - 1
xxl-job-admin/src/main/java/com/xxl/job/admin/dao/impl/XxlJobLogDaoImpl.java 查看文件

@@ -55,7 +55,7 @@ public class XxlJobLogDaoImpl implements IXxlJobLogDao {
55 55
 	public int save(XxlJobLog xxlJobLog) {
56 56
 		return sqlSessionTemplate.insert("XxlJobLogMapper.save", xxlJobLog);
57 57
 	}
58
-	
58
+
59 59
 	@Override
60 60
 	public int updateTriggerInfo(XxlJobLog xxlJobLog) {
61 61
 		if (xxlJobLog.getTriggerMsg()!=null && xxlJobLog.getTriggerMsg().length()>2000) {

+ 6 - 12
xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobLogMapper.xml 查看文件

@@ -88,26 +88,20 @@
88 88
 	<insert id="save" parameterType="com.xxl.job.admin.core.model.XxlJobLog" useGeneratedKeys="true" keyProperty="id" >
89 89
 		INSERT INTO XXL_JOB_QRTZ_TRIGGER_LOG (
90 90
 			`job_group`,
91
-			`job_id`,
92
-			`executor_address`,
93
-			`executor_handler`,
94
-			`executor_param`
91
+			`job_id`
95 92
 		) VALUES (
96 93
 			#{jobGroup},
97
-			#{jobId},
98
-			#{executorAddress},
99
-			#{executorHandler},
100
-			#{executorParam}
94
+			#{jobId}
101 95
 		);
102 96
 		<selectKey resultType="java.lang.Integer" order="AFTER" keyProperty="id"> 
103 97
 			SELECT LAST_INSERT_ID() 
104 98
 		</selectKey> 
105 99
 	</insert>
106
-	
100
+
107 101
 	<update id="updateTriggerInfo">
108 102
 		UPDATE XXL_JOB_QRTZ_TRIGGER_LOG
109
-		SET 
110
-			`trigger_time`= #{triggerTime}, 
103
+		SET
104
+			`trigger_time`= #{triggerTime},
111 105
 			`trigger_code`= #{triggerCode},
112 106
 			`trigger_msg`= #{triggerMsg},
113 107
 			`executor_address`= #{executorAddress},
@@ -115,7 +109,7 @@
115 109
 			`executor_param`= #{executorParam}
116 110
 		WHERE `id`= #{id}
117 111
 	</update>
118
-	
112
+
119 113
 	<update id="updateHandleInfo">
120 114
 		UPDATE XXL_JOB_QRTZ_TRIGGER_LOG
121 115
 		SET 

+ 3 - 3
xxl-job-admin/src/main/webapp/WEB-INF/template/joblog/joblog.index.ftl 查看文件

@@ -78,12 +78,12 @@
78 78
 					                	<th name="id" >id</th>
79 79
                                         <th name="jobGroup" >执行器ID</th>
80 80
 					                	<th name="jobId" >任务ID</th>
81
+                                        <th name="triggerTime" >调度时间</th>
82
+                                        <th name="triggerCode" >调度结果</th>
83
+                                        <th name="triggerMsg" >调度备注</th>
81 84
 					                  	<th name="executorAddress" >执行器地址</th>
82 85
                                         <th name="executorHandler" >JobHandler</th>
83 86
 					                  	<th name="executorParam" >任务参数</th>
84
-					                  	<th name="triggerTime" >调度时间</th>
85
-					                  	<th name="triggerCode" >调度结果</th>
86
-					                  	<th name="triggerMsg" >调度备注</th>
87 87
 					                  	<th name="handleTime" >执行时间</th>
88 88
 					                  	<th name="handleCode" >执行结果</th>
89 89
 					                  	<th name="handleMsg" >执行备注</th>

+ 1 - 1
xxl-job-admin/src/main/webapp/static/js/jobinfo.index.1.js 查看文件

@@ -138,7 +138,7 @@ $(function() {
138 138
 			"sProcessing" : "处理中...",
139 139
 			"sLengthMenu" : "每页 _MENU_ 条记录",
140 140
 			"sZeroRecords" : "没有匹配结果",
141
-			"sInfo" : "第 _PAGE_ 页 ( 总共 _PAGES_ 页 )",
141
+			"sInfo" : "第 _PAGE_ 页 ( 总共 _PAGES_ 页,_TOTAL_ 条记录 )",
142 142
 			"sInfoEmpty" : "无记录",
143 143
 			"sInfoFiltered" : "(由 _MAX_ 项结果过滤)",
144 144
 			"sInfoPostFix" : "",

+ 20 - 19
xxl-job-admin/src/main/webapp/static/js/joblog.index.1.js 查看文件

@@ -81,6 +81,25 @@ $(function() {
81 81
 	                { "data": 'id', "bSortable": false, "visible" : false},
82 82
 					{ "data": 'jobGroup', "visible" : false},
83 83
 	                { "data": 'jobId', "visible" : false},
84
+					{
85
+						"data": 'triggerTime',
86
+						"render": function ( data, type, row ) {
87
+							return data?moment(new Date(data)).format("YYYY-MM-DD HH:mm:ss"):"";
88
+						}
89
+					},
90
+					{
91
+						"data": 'triggerCode',
92
+						"render": function ( data, type, row ) {
93
+							return (data==200)?'<span style="color: green">成功</span>':(data==500)?'<span style="color: red">失败</span>':(data==0)?'':data;
94
+						}
95
+
96
+					},
97
+					{
98
+						"data": 'triggerMsg',
99
+						"render": function ( data, type, row ) {
100
+							return data?'<a class="logTips" href="javascript:;" >查看<span style="display:none;">'+ data +'</span></a>':"无";
101
+						}
102
+					},
84 103
 	                { "data": 'executorAddress', "visible" : true},
85 104
 					{
86 105
 						"data": 'executorHandler',
@@ -90,25 +109,7 @@ $(function() {
90 109
 						}
91 110
 					},
92 111
 	                { "data": 'executorParam', "visible" : true},
93
-	                { 
94
-	                	"data": 'triggerTime', 
95
-	                	"render": function ( data, type, row ) {
96
-	                		return data?moment(new Date(data)).format("YYYY-MM-DD HH:mm:ss"):"";
97
-	                	}
98
-	                },
99
-	                {
100
-						"data": 'triggerCode',
101
-						"render": function ( data, type, row ) {
102
-							return (data==200)?'<span style="color: green">成功</span>':(data==500)?'<span style="color: red">失败</span>':(data==0)?'':data;
103
-						}
104 112
 
105
-	                },
106
-	                { 
107
-	                	"data": 'triggerMsg',
108
-	                	"render": function ( data, type, row ) {
109
-	                		return data?'<a class="logTips" href="javascript:;" >查看<span style="display:none;">'+ data +'</span></a>':"无";
110
-	                	}
111
-	                },
112 113
 	                { 
113 114
 	                	"data": 'handleTime',
114 115
 	                	"render": function ( data, type, row ) {
@@ -147,7 +148,7 @@ $(function() {
147 148
 			"sProcessing" : "处理中...",
148 149
 			"sLengthMenu" : "每页 _MENU_ 条记录",
149 150
 			"sZeroRecords" : "没有匹配结果",
150
-			"sInfo" : "第 _PAGE_ 页 ( 总共 _PAGES_ 页 )",
151
+			"sInfo" : "第 _PAGE_ 页 ( 总共 _PAGES_ 页,_TOTAL_ 条记录 )",
151 152
 			"sInfoEmpty" : "无记录",
152 153
 			"sInfoFiltered" : "(由 _MAX_ 项结果过滤)",
153 154
 			"sInfoPostFix" : "",

+ 10 - 1
xxl-job-core/src/main/java/com/xxl/job/core/util/HttpClientUtil.java 查看文件

@@ -1,5 +1,7 @@
1 1
 package com.xxl.job.core.util;
2 2
 
3
+import com.xxl.job.core.rpc.codec.RpcResponse;
4
+import com.xxl.job.core.rpc.serialize.HessianSerializer;
3 5
 import org.apache.http.HttpEntity;
4 6
 import org.apache.http.HttpResponse;
5 7
 import org.apache.http.client.methods.HttpPost;
@@ -8,6 +10,8 @@ import org.apache.http.entity.ContentType;
8 10
 import org.apache.http.impl.client.CloseableHttpClient;
9 11
 import org.apache.http.impl.client.HttpClients;
10 12
 import org.apache.http.util.EntityUtils;
13
+import org.slf4j.Logger;
14
+import org.slf4j.LoggerFactory;
11 15
 
12 16
 import javax.servlet.http.HttpServletRequest;
13 17
 import java.io.IOException;
@@ -18,6 +22,7 @@ import java.io.InputStream;
18 22
  * @author xuxueli 2015-10-31 19:50:41
19 23
  */
20 24
 public class HttpClientUtil {
25
+	private static Logger logger = LoggerFactory.getLogger(HttpClientUtil.class);
21 26
 
22 27
 	/**
23 28
 	 * post request
@@ -47,7 +52,11 @@ public class HttpClientUtil {
47 52
 				EntityUtils.consume(entity);
48 53
 			}
49 54
 		} catch (Exception e) {
50
-			e.printStackTrace();
55
+			logger.error("", e);
56
+
57
+			RpcResponse rpcResponse = new RpcResponse();
58
+			rpcResponse.setError(e.getMessage());
59
+			responseBytes = HessianSerializer.serialize(rpcResponse);
51 60
 		} finally {
52 61
 			httpPost.releaseConnection();
53 62
 			try {