Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
熊鹏飞
/
xxljob220
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
3c95ba5a
authored
Dec 20, 2017
by
xuxueli
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Log地址格式兼容,支持非"/"结尾路径配置;
parent
fc7a5026
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
37 additions
and
16 deletions
doc/XXL-JOB官方文档.md
xxl-job-core/src/main/java/com/xxl/job/core/executor/XxlJobExecutor.java
xxl-job-core/src/main/java/com/xxl/job/core/handler/impl/ScriptJobHandler.java
xxl-job-core/src/main/java/com/xxl/job/core/log/XxlJobFileAppender.java
xxl-job-core/src/main/java/com/xxl/job/core/util/ScriptUtil.java
doc/XXL-JOB官方文档.md
View file @
3c95ba5a
## 《分
布式任务调度平台XXL-JOB》
## 《分
布式任务调度平台XXL-JOB》
...
...
@@ -1077,6 +1077,8 @@ Tips: 历史版本(V1.3.x)目前已经Release至稳定版本, 进入维护阶段
-
12、调度报表优化,支持时间区间筛选;
-
13、Log组件支持输出异常栈信息,底层实现优化;
-
14、失败重试:调度中心调度失败且启用"失败重试"策略时,将会自动重试一次;执行器执行失败且回调失败重试状态时,也将会自动重试一次;
-
15、Log地址格式兼容,支持非"/"结尾路径配置;
### TODO LIST
-
1、任务权限管理:执行器为粒度分配权限,核心操作校验权限;
...
...
@@ -1096,9 +1098,7 @@ Tips: 历史版本(V1.3.x)目前已经Release至稳定版本, 进入维护阶段
-
15、Bean模式任务,JobHandler自动从执行器中查询展示为下拉框,选择后自动填充任务名称等属性;
-
16、任务告警邮件优化,调整为表格形式;
-
17、JobHandler提供 init/destroy 方法,支持自定义任务线程销毁逻辑;
-
18、执行器回调地址/日志地址格式兼容,是否已"/"结尾均支持;
-
18、执行器回调地址格式兼容,支持非"/"结尾路径配置;
## 七、其他
...
...
xxl-job-core/src/main/java/com/xxl/job/core/executor/XxlJobExecutor.java
View file @
3c95ba5a
...
...
@@ -72,14 +72,10 @@ public class XxlJobExecutor implements ApplicationContextAware {
initAdminBizList
(
adminAddresses
,
accessToken
);
// init executor-jobHandlerRepository
if
(
applicationContext
!=
null
)
{
initJobHandlerRepository
(
applicationContext
);
}
initJobHandlerRepository
(
applicationContext
);
// init logpath
if
(
logPath
!=
null
&&
logPath
.
trim
().
length
()>
0
)
{
XxlJobFileAppender
.
logPath
=
logPath
;
}
XxlJobFileAppender
.
initLogPath
(
logPath
);
// init executor-server
initExecutorServer
(
port
,
ip
,
appName
,
accessToken
);
...
...
@@ -145,6 +141,10 @@ public class XxlJobExecutor implements ApplicationContextAware {
return
jobHandlerRepository
.
get
(
name
);
}
private
static
void
initJobHandlerRepository
(
ApplicationContext
applicationContext
){
if
(
applicationContext
==
null
)
{
return
;
}
// init job handler action
Map
<
String
,
Object
>
serviceBeanMap
=
applicationContext
.
getBeansWithAnnotation
(
JobHandler
.
class
);
...
...
xxl-job-core/src/main/java/com/xxl/job/core/handler/impl/ScriptJobHandler.java
View file @
3c95ba5a
...
...
@@ -36,20 +36,20 @@ public class ScriptJobHandler extends IJobHandler {
String
scriptFileName
=
null
;
if
(
GlueTypeEnum
.
GLUE_SHELL
==
glueType
)
{
cmd
=
"bash"
;
scriptFileName
=
XxlJobFileAppender
.
logPath
.
concat
(
"gluesource/"
).
concat
(
String
.
valueOf
(
jobId
)).
concat
(
"_"
).
concat
(
String
.
valueOf
(
glueUpdatetime
)).
concat
(
".sh"
);
scriptFileName
=
XxlJobFileAppender
.
getLogPath
()
.
concat
(
"gluesource/"
).
concat
(
String
.
valueOf
(
jobId
)).
concat
(
"_"
).
concat
(
String
.
valueOf
(
glueUpdatetime
)).
concat
(
".sh"
);
}
else
if
(
GlueTypeEnum
.
GLUE_PYTHON
==
glueType
)
{
cmd
=
"python"
;
scriptFileName
=
XxlJobFileAppender
.
logPath
.
concat
(
"gluesource/"
).
concat
(
String
.
valueOf
(
jobId
)).
concat
(
"_"
).
concat
(
String
.
valueOf
(
glueUpdatetime
)).
concat
(
".py"
);
scriptFileName
=
XxlJobFileAppender
.
getLogPath
()
.
concat
(
"gluesource/"
).
concat
(
String
.
valueOf
(
jobId
)).
concat
(
"_"
).
concat
(
String
.
valueOf
(
glueUpdatetime
)).
concat
(
".py"
);
}
else
if
(
GlueTypeEnum
.
GLUE_NODEJS
==
glueType
)
{
cmd
=
"node"
;
scriptFileName
=
XxlJobFileAppender
.
logPath
.
concat
(
"gluesource/"
).
concat
(
String
.
valueOf
(
jobId
)).
concat
(
"_"
).
concat
(
String
.
valueOf
(
glueUpdatetime
)).
concat
(
".js"
);
scriptFileName
=
XxlJobFileAppender
.
getLogPath
()
.
concat
(
"gluesource/"
).
concat
(
String
.
valueOf
(
jobId
)).
concat
(
"_"
).
concat
(
String
.
valueOf
(
glueUpdatetime
)).
concat
(
".js"
);
}
// make script file
ScriptUtil
.
markScriptFile
(
scriptFileName
,
gluesource
);
// log file
String
logFileName
=
XxlJobFileAppender
.
logPath
.
concat
(
XxlJobFileAppender
.
contextHolder
.
get
());
String
logFileName
=
XxlJobFileAppender
.
getLogPath
()
.
concat
(
XxlJobFileAppender
.
contextHolder
.
get
());
// invoke
XxlJobLogger
.
log
(
"----------- script file:"
+
scriptFileName
+
" -----------"
);
...
...
xxl-job-core/src/main/java/com/xxl/job/core/log/XxlJobFileAppender.java
View file @
3c95ba5a
...
...
@@ -18,7 +18,28 @@ public class XxlJobFileAppender {
// for JobThread (support log for child thread of job handler)
//public static ThreadLocal<String> contextHolder = new ThreadLocal<String>();
public
static
final
InheritableThreadLocal
<
String
>
contextHolder
=
new
InheritableThreadLocal
<
String
>();
public
static
String
logPath
=
"/data/applogs/xxl-job/jobhandler/"
;
private
static
String
logPath
=
"/data/applogs/xxl-job/jobhandler/"
;
public
static
void
initLogPath
(
String
logPath
){
// init
if
(
logPath
!=
null
&&
logPath
.
trim
().
length
()>
0
)
{
/*if (!logPath.endsWith("/")) {
logPath = logPath.concat("/");
}*/
XxlJobFileAppender
.
logPath
=
logPath
;
}
// mk dir
File
logPathDir
=
new
File
(
XxlJobFileAppender
.
logPath
);
if
(!
logPathDir
.
exists
())
{
logPathDir
.
mkdirs
();
}
XxlJobFileAppender
.
logPath
=
logPathDir
.
getPath
();
}
public
static
String
getLogPath
()
{
return
logPath
;
}
/**
* log filename: yyyy-MM-dd/9999.log
...
...
xxl-job-core/src/main/java/com/xxl/job/core/util/ScriptUtil.java
View file @
3c95ba5a
...
...
@@ -28,7 +28,7 @@ public class ScriptUtil {
*/
public
static
void
markScriptFile
(
String
scriptFileName
,
String
content
)
throws
IOException
{
// filePath/
File
filePathDir
=
new
File
(
XxlJobFileAppender
.
logPath
);
File
filePathDir
=
new
File
(
XxlJobFileAppender
.
getLogPath
()
);
if
(!
filePathDir
.
exists
())
{
filePathDir
.
mkdirs
();
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment