Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
aboota
xxl-job
提交
22da65c2
X
xxl-job
项目概览
aboota
/
xxl-job
与 Fork 源项目一致
从无法访问的项目Fork
通知
10
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
xxl-job
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
22da65c2
编写于
5月 15, 2018
作者:
许雪里
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
任务回调结果优化,支持展示在Rolling log中,方便问题排查
上级
5c24778f
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
35 addition
and
10 deletion
+35
-10
doc/XXL-JOB官方文档.md
doc/XXL-JOB官方文档.md
+1
-1
xxl-job-core/src/main/java/com/xxl/job/core/biz/model/HandleCallbackParam.java
.../java/com/xxl/job/core/biz/model/HandleCallbackParam.java
+14
-1
xxl-job-core/src/main/java/com/xxl/job/core/thread/JobThread.java
...core/src/main/java/com/xxl/job/core/thread/JobThread.java
+3
-4
xxl-job-core/src/main/java/com/xxl/job/core/thread/TriggerCallbackThread.java
...n/java/com/xxl/job/core/thread/TriggerCallbackThread.java
+17
-4
未找到文件。
doc/XXL-JOB官方文档.md
浏览文件 @
22da65c2
...
...
@@ -1199,7 +1199,7 @@ Tips: 历史版本(V1.3.x)目前已经Release至稳定版本, 进入维护阶段
-
8、Window机器下File.separator不兼容问题修复;
-
9、任务日志查询速度优化,百万级别日志量搜索速度提升1000倍;
-
10、底层LocalCache组件兼容性优化,支持jdk、jdk10编译部署;
-
11、
[迭代中]回调log优化,支持展示在rolling log中,方便排查问题
;
-
11、
任务回调结果优化,支持展示在Rolling log中,方便问题排查
;
-
12、脚本任务异常Log输出优化;
...
...
xxl-job-core/src/main/java/com/xxl/job/core/biz/model/HandleCallbackParam.java
浏览文件 @
22da65c2
...
...
@@ -9,11 +9,14 @@ public class HandleCallbackParam implements Serializable {
private
static
final
long
serialVersionUID
=
42L
;
private
int
logId
;
private
long
logDateTim
;
private
ReturnT
<
String
>
executeResult
;
public
HandleCallbackParam
(){}
public
HandleCallbackParam
(
int
logId
,
ReturnT
<
String
>
executeResult
)
{
public
HandleCallbackParam
(
int
logId
,
long
logDateTim
,
ReturnT
<
String
>
executeResult
)
{
this
.
logId
=
logId
;
this
.
logDateTim
=
logDateTim
;
this
.
executeResult
=
executeResult
;
}
...
...
@@ -25,6 +28,14 @@ public class HandleCallbackParam implements Serializable {
this
.
logId
=
logId
;
}
public
long
getLogDateTim
()
{
return
logDateTim
;
}
public
void
setLogDateTim
(
long
logDateTim
)
{
this
.
logDateTim
=
logDateTim
;
}
public
ReturnT
<
String
>
getExecuteResult
()
{
return
executeResult
;
}
...
...
@@ -37,7 +48,9 @@ public class HandleCallbackParam implements Serializable {
public
String
toString
()
{
return
"HandleCallbackParam{"
+
"logId="
+
logId
+
", logDateTim="
+
logDateTim
+
", executeResult="
+
executeResult
+
'}'
;
}
}
xxl-job-core/src/main/java/com/xxl/job/core/thread/JobThread.java
浏览文件 @
22da65c2
...
...
@@ -14,7 +14,6 @@ import org.slf4j.LoggerFactory;
import
java.io.PrintWriter
;
import
java.io.StringWriter
;
import
java.util.Arrays
;
import
java.util.Date
;
import
java.util.concurrent.LinkedBlockingQueue
;
import
java.util.concurrent.TimeUnit
;
...
...
@@ -148,11 +147,11 @@ public class JobThread extends Thread{
// callback handler info
if
(!
toStop
)
{
// commonm
TriggerCallbackThread
.
pushCallBack
(
new
HandleCallbackParam
(
triggerParam
.
getLogId
(),
executeResult
));
TriggerCallbackThread
.
pushCallBack
(
new
HandleCallbackParam
(
triggerParam
.
getLogId
(),
triggerParam
.
getLogDateTim
(),
executeResult
));
}
else
{
// is killed
ReturnT
<
String
>
stopResult
=
new
ReturnT
<
String
>(
ReturnT
.
FAIL_CODE
,
stopReason
+
" [业务运行中,被强制终止]"
);
TriggerCallbackThread
.
pushCallBack
(
new
HandleCallbackParam
(
triggerParam
.
getLogId
(),
stopResult
));
TriggerCallbackThread
.
pushCallBack
(
new
HandleCallbackParam
(
triggerParam
.
getLogId
(),
triggerParam
.
getLogDateTim
(),
stopResult
));
}
}
}
...
...
@@ -164,7 +163,7 @@ public class JobThread extends Thread{
if
(
triggerParam
!=
null
)
{
// is killed
ReturnT
<
String
>
stopResult
=
new
ReturnT
<
String
>(
ReturnT
.
FAIL_CODE
,
stopReason
+
" [任务尚未执行,在调度队列中被终止]"
);
TriggerCallbackThread
.
pushCallBack
(
new
HandleCallbackParam
(
triggerParam
.
getLogId
(),
stopResult
));
TriggerCallbackThread
.
pushCallBack
(
new
HandleCallbackParam
(
triggerParam
.
getLogId
(),
triggerParam
.
getLogDateTim
(),
stopResult
));
}
}
...
...
xxl-job-core/src/main/java/com/xxl/job/core/thread/TriggerCallbackThread.java
浏览文件 @
22da65c2
...
...
@@ -4,10 +4,13 @@ import com.xxl.job.core.biz.AdminBiz;
import
com.xxl.job.core.biz.model.HandleCallbackParam
;
import
com.xxl.job.core.biz.model.ReturnT
;
import
com.xxl.job.core.executor.XxlJobExecutor
;
import
com.xxl.job.core.log.XxlJobFileAppender
;
import
com.xxl.job.core.log.XxlJobLogger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.concurrent.LinkedBlockingQueue
;
...
...
@@ -108,17 +111,27 @@ public class TriggerCallbackThread {
try
{
ReturnT
<
String
>
callbackResult
=
adminBiz
.
callback
(
callbackParamList
);
if
(
callbackResult
!=
null
&&
ReturnT
.
SUCCESS_CODE
==
callbackResult
.
getCode
())
{
callbackResult
=
ReturnT
.
SUCCESS
;
logger
.
info
(
">>>>>>>>>>> xxl-job callback success, callbackParamList:{}, callbackResult:{}"
,
new
Object
[]{
callbackParamList
,
callbackResult
});
callbackLog
(
callbackParamList
,
"<br>----------- xxl-job callback success"
);
break
;
}
else
{
logger
.
info
(
">>>>>>>>>>> xxl-job callback fail, callbackParamList:{}, callbackResult:{}"
,
new
Object
[]{
callbackParamList
,
callbackResult
}
);
callbackLog
(
callbackParamList
,
"<br>----------- xxl-job callback fail, callbackResult:"
+
callbackResult
);
}
}
catch
(
Exception
e
)
{
logger
.
error
(
">>>>>>>>>>> xxl-job callback error, callbackParamList:{}"
,
callbackParamList
,
e
);
callbackLog
(
callbackParamList
,
"<br>----------- xxl-job callback error, errorMsg:"
+
e
.
getMessage
()
);
//getInstance().callBackQueue.addAll(callbackParamList);
}
}
}
/**
* callback log
*/
private
void
callbackLog
(
List
<
HandleCallbackParam
>
callbackParamList
,
String
logContent
){
for
(
HandleCallbackParam
callbackParam:
callbackParamList
)
{
String
logFileName
=
XxlJobFileAppender
.
makeLogFileName
(
new
Date
(
callbackParam
.
getLogDateTim
()),
callbackParam
.
getLogId
());
XxlJobFileAppender
.
contextHolder
.
set
(
logFileName
);
XxlJobLogger
.
log
(
logContent
);
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录