Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
X
XXL-JOB
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
靳帅
XXL-JOB
Commits
7a781ad3
提交
7a781ad3
authored
4月 26, 2017
作者:
xueli.xue
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
1、GLUE版本逻辑调整;
上级
548426e9
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
12 个修改的文件
包含
238 行增加
和
327 行删除
+238
-327
JobCodeController.java
.../java/com/xxl/job/admin/controller/JobCodeController.java
+17
-10
XxlJobServiceImpl.java
...ava/com/xxl/job/admin/service/impl/XxlJobServiceImpl.java
+0
-6
jobcode.index.ftl
...rc/main/webapp/WEB-INF/template/jobcode/jobcode.index.ftl
+15
-4
jobinfo.index.ftl
...rc/main/webapp/WEB-INF/template/jobinfo/jobinfo.index.ftl
+36
-4
joblog.detail.ftl
...src/main/webapp/WEB-INF/template/joblog/joblog.detail.ftl
+1
-1
jobcode.index.1.js
xxl-job-admin/src/main/webapp/static/js/jobcode.index.1.js
+27
-9
jobinfo.index.1.js
xxl-job-admin/src/main/webapp/static/js/jobinfo.index.1.js
+0
-12
test.js
.../main/webapp/static/plugins/codemirror/mode/clike/test.js
+0
-51
groovy.js
...in/webapp/static/plugins/codemirror/mode/groovy/groovy.js
+0
-230
python.js
...in/webapp/static/plugins/codemirror/mode/python/python.js
+0
-0
shell.js
...main/webapp/static/plugins/codemirror/mode/shell/shell.js
+139
-0
JobThread.java
...core/src/main/java/com/xxl/job/core/thread/JobThread.java
+3
-0
没有找到文件。
xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobCodeController.java
浏览文件 @
7a781ad3
...
...
@@ -5,6 +5,7 @@ import com.xxl.job.admin.core.model.XxlJobLogGlue;
import
com.xxl.job.admin.dao.IXxlJobInfoDao
;
import
com.xxl.job.admin.dao.IXxlJobLogGlueDao
;
import
com.xxl.job.core.biz.model.ReturnT
;
import
com.xxl.job.core.glue.GlueTypeEnum
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.Model
;
import
org.springframework.web.bind.annotation.RequestMapping
;
...
...
@@ -35,6 +36,12 @@ public class JobCodeController {
if
(
jobInfo
==
null
)
{
throw
new
RuntimeException
(
"抱歉,任务不存在."
);
}
if
(
GlueTypeEnum
.
BEAN
==
GlueTypeEnum
.
match
(
jobInfo
.
getGlueType
()))
{
throw
new
RuntimeException
(
"该任务非GLUE模式."
);
}
// Glue类型-字典
model
.
addAttribute
(
"GlueTypeEnum"
,
GlueTypeEnum
.
values
());
model
.
addAttribute
(
"jobInfo"
,
jobInfo
);
model
.
addAttribute
(
"jobLogGlues"
,
jobLogGlues
);
...
...
@@ -48,28 +55,28 @@ public class JobCodeController {
if
(
glueRemark
==
null
)
{
return
new
ReturnT
<
String
>(
500
,
"请输入备注"
);
}
if
(
glueRemark
.
length
()<
6
||
glueRemark
.
length
()>
100
)
{
return
new
ReturnT
<
String
>(
500
,
"备注长度应该在
6
至100之间"
);
if
(
glueRemark
.
length
()<
4
||
glueRemark
.
length
()>
100
)
{
return
new
ReturnT
<
String
>(
500
,
"备注长度应该在
4
至100之间"
);
}
XxlJobInfo
exists_jobInfo
=
xxlJobInfoDao
.
loadById
(
id
);
if
(
exists_jobInfo
==
null
)
{
return
new
ReturnT
<
String
>(
500
,
"参数异常"
);
}
// log old code
XxlJobLogGlue
xxlJobLogGlue
=
new
XxlJobLogGlue
();
xxlJobLogGlue
.
setJobId
(
exists_jobInfo
.
getId
());
xxlJobLogGlue
.
setGlueType
(
exists_jobInfo
.
getGlueType
());
xxlJobLogGlue
.
setGlueSource
(
exists_jobInfo
.
getGlueSource
());
xxlJobLogGlue
.
setGlueRemark
(
exists_jobInfo
.
getGlueRemark
());
xxlJobLogGlueDao
.
save
(
xxlJobLogGlue
);
// update new code
exists_jobInfo
.
setGlueSource
(
glueSource
);
exists_jobInfo
.
setGlueRemark
(
glueRemark
);
exists_jobInfo
.
setGlueUpdatetime
(
new
Date
());
xxlJobInfoDao
.
update
(
exists_jobInfo
);
// log old code
XxlJobLogGlue
xxlJobLogGlue
=
new
XxlJobLogGlue
();
xxlJobLogGlue
.
setJobId
(
exists_jobInfo
.
getId
());
xxlJobLogGlue
.
setGlueType
(
exists_jobInfo
.
getGlueType
());
xxlJobLogGlue
.
setGlueSource
(
glueSource
);
xxlJobLogGlue
.
setGlueRemark
(
glueRemark
);
xxlJobLogGlueDao
.
save
(
xxlJobLogGlue
);
// remove code backup more than 30
xxlJobLogGlueDao
.
removeOld
(
exists_jobInfo
.
getId
(),
30
);
...
...
xxl-job-admin/src/main/java/com/xxl/job/admin/service/impl/XxlJobServiceImpl.java
浏览文件 @
7a781ad3
...
...
@@ -79,9 +79,6 @@ public class XxlJobServiceImpl implements IXxlJobService {
if
(
StringUtils
.
isBlank
(
jobInfo
.
getAuthor
()))
{
return
new
ReturnT
<
String
>(
500
,
"请输入“负责人”"
);
}
if
(
StringUtils
.
isBlank
(
jobInfo
.
getAlarmEmail
()))
{
return
new
ReturnT
<
String
>(
500
,
"请输入“报警邮件”"
);
}
if
(
ExecutorRouteStrategyEnum
.
match
(
jobInfo
.
getExecutorRouteStrategy
(),
null
)
==
null
)
{
return
new
ReturnT
<
String
>(
500
,
"路由策略非法"
);
}
...
...
@@ -145,9 +142,6 @@ public class XxlJobServiceImpl implements IXxlJobService {
if
(
StringUtils
.
isBlank
(
jobInfo
.
getAuthor
()))
{
return
new
ReturnT
<
String
>(
500
,
"请输入“负责人”"
);
}
if
(
StringUtils
.
isBlank
(
jobInfo
.
getAlarmEmail
()))
{
return
new
ReturnT
<
String
>(
500
,
"请输入“报警邮件”"
);
}
if
(
ExecutorRouteStrategyEnum
.
match
(
jobInfo
.
getExecutorRouteStrategy
(),
null
)
==
null
)
{
return
new
ReturnT
<
String
>(
500
,
"路由策略非法"
);
}
...
...
xxl-job-admin/src/main/webapp/WEB-INF/template/jobcode/jobcode.index.ftl
浏览文件 @
7a781ad3
...
...
@@ -26,7 +26,7 @@
<div
class=
"container"
>
<
#
--
icon
--
>
<div
class=
"navbar-header"
>
<a
href=
"../../index2.html"
class=
"navbar-brand"
><b>
Web
</b>
IDE
</a>
<a
class=
"navbar-brand"
><b>
Web
</b>
IDE
</a>
<button
type=
"button"
class=
"navbar-toggle collapsed"
data-toggle=
"collapse"
data-target=
"#navbar-collapse"
>
<i
class=
"fa fa-bars"
></i>
</button>
...
...
@@ -35,7 +35,7 @@
<
#
--
left
nav
--
>
<div
class=
"collapse navbar-collapse pull-left"
id=
"navbar-collapse"
>
<ul
class=
"nav navbar-nav"
>
<li
class=
"active"
><a
href=
"javascript:;"
>
任务:${jobInfo.jobDesc}
<span
class=
"sr-only"
>
(current)
</span></a></li>
<li
class=
"active"
><a
href=
"javascript:;"
>
<
#
list
GlueTypeEnum
as
item
><
#
if
item =
=
jobInfo
.
glueType
>
${item.desc}
</
#
if></
#
list>
任务:${jobInfo.jobDesc}
<span
class=
"sr-only"
>
(current)
</span></a></li>
</ul>
</div>
...
...
@@ -45,11 +45,19 @@
<li
class=
"dropdown"
>
<a
href=
"#"
class=
"dropdown-toggle"
data-toggle=
"dropdown"
aria-expanded=
"false"
>
版本回溯
<span
class=
"caret"
></span></a>
<ul
class=
"dropdown-menu"
role=
"menu"
>
<li><a
href=
"javascript:;"
class=
"source_version"
version=
"version_now"
>
${jobInfo.glueRemark}【OnLine】
</a></li>
<li
<#
if
jobLogGlues
?
exists
&&
jobLogGlues
?
size
gt
0
>
style="display: none;"
</
#
if>
>
<a
href=
"javascript:;"
class=
"source_version"
version=
"version_now"
glueType=
"${jobInfo.glueType}"
>
<
#
list
GlueTypeEnum
as
item
><
#
if
item =
=
jobInfo
.
glueType
>
${item.desc}
</
#
if></
#
list>
: ${jobInfo.glueRemark}
</a>
</li>
<textarea
id=
"version_now"
style=
"display:none;"
>
${jobInfo.glueSource}
</textarea>
<
#
if
jobLogGlues
?
exists
&&
jobLogGlues
?
size
gt
0
>
<
#
list
jobLogGlues
as
glue
>
<li><a
href=
"javascript:;"
class=
"source_version"
version=
"version_${glue.id}"
>
${glue.glueRemark}
</a></li>
<li>
<a
href=
"javascript:;"
class=
"source_version"
version=
"version_${glue.id}"
glueType=
"${glue.glueType}"
>
<
#
list
GlueTypeEnum
as
item
><
#
if
item =
=
glue
.
glueType
>
${item.desc}
</
#
if></
#
list>
: ${glue.glueRemark}
</a>
</li>
<textarea
id=
"version_${glue.id}"
style=
"display:none;"
>
${glue.glueSource}
</textarea>
</
#
list>
</
#
if>
...
...
@@ -103,10 +111,13 @@
<
@
netCommon
.
commonScript
/>
<script
src=
"${request.contextPath}/static/plugins/codemirror/lib/codemirror.js"
></script>
<script
src=
"${request.contextPath}/static/plugins/codemirror/mode/clike/clike.js"
></script>
<script
src=
"${request.contextPath}/static/plugins/codemirror/mode/shell/shell.js"
></script>
<script
src=
"${request.contextPath}/static/plugins/codemirror/mode/python/python.js"
></script>
<script
src=
"${request.contextPath}/static/plugins/codemirror/addon/hint/show-hint.js"
></script>
<script
src=
"${request.contextPath}/static/plugins/codemirror/addon/hint/anyword-hint.js"
></script>
<script>
var
id
=
'${jobInfo.id}'
;
var
glueType
=
'${jobInfo.glueType}'
;
</script>
<script
src=
"${request.contextPath}/static/js/jobcode.index.1.js"
></script>
...
...
xxl-job-admin/src/main/webapp/WEB-INF/template/jobinfo/jobinfo.index.ftl
浏览文件 @
7a781ad3
...
...
@@ -154,10 +154,10 @@
<div
class=
"col-sm-4"
><input
type=
"text"
class=
"form-control"
name=
"childJobKey"
placeholder=
"请输入子任务的任务Key,如存在多个逗号分隔"
maxlength=
"100"
></div>
</div>
<div
class=
"form-group"
>
<label
for=
"lastname"
class=
"col-sm-2 control-label"
>
报警邮件
<font
color=
"red"
>
*
</font></label>
<div
class=
"col-sm-4"
><input
type=
"text"
class=
"form-control"
name=
"alarmEmail"
placeholder=
"请输入“报警邮件”,多个邮件地址逗号分隔"
maxlength=
"100"
></div>
<label
for=
"lastname"
class=
"col-sm-2 control-label"
>
负责人
<font
color=
"red"
>
*
</font></label>
<div
class=
"col-sm-4"
><input
type=
"text"
class=
"form-control"
name=
"author"
placeholder=
"请输入“负责人”"
maxlength=
"50"
></div>
<label
for=
"lastname"
class=
"col-sm-2 control-label"
>
报警邮件
<font
color=
"black"
>
*
</font></label>
<div
class=
"col-sm-4"
><input
type=
"text"
class=
"form-control"
name=
"alarmEmail"
placeholder=
"请输入“报警邮件”,多个邮件地址逗号分隔"
maxlength=
"100"
></div>
</div>
<hr>
...
...
@@ -188,6 +188,38 @@ public class DemoGlueJobHandler extends IJobHandler {
}
}
</textarea>
<textarea
name=
"glueSource_shell"
style=
"display:none;"
>
#!/bin/bash
echo hello shell
for x in 1 2 3 4
do
echo number=$x
sleep 1s
done
echo1 111
printf 666
echo2 222
</textarea>
<textarea
name=
"glueSource_python"
style=
"display:none;"
>
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import logging
import time
logging.basicConfig(level=logging.DEBUG)
logging.info('hello python')
for num in range(0, 3):
time.sleep(1)
logging.info('当前序号 :' + str(num) )
logging.info('Good bye!')
</textarea>
</form>
...
...
@@ -248,10 +280,10 @@ public class DemoGlueJobHandler extends IJobHandler {
<div
class=
"col-sm-4"
><input
type=
"text"
class=
"form-control"
name=
"childJobKey"
placeholder=
"请输入子任务的任务Key,如存在多个逗号分隔"
maxlength=
"100"
></div>
</div>
<div
class=
"form-group"
>
<label
for=
"lastname"
class=
"col-sm-2 control-label"
>
报警邮件
<font
color=
"red"
>
*
</font></label>
<div
class=
"col-sm-4"
><input
type=
"text"
class=
"form-control"
name=
"alarmEmail"
placeholder=
"请输入“报警邮件”,多个邮件地址逗号分隔"
maxlength=
"100"
></div>
<label
for=
"lastname"
class=
"col-sm-2 control-label"
>
负责人
<font
color=
"red"
>
*
</font></label>
<div
class=
"col-sm-4"
><input
type=
"text"
class=
"form-control"
name=
"author"
placeholder=
"请输入“负责人”"
maxlength=
"50"
></div>
<label
for=
"lastname"
class=
"col-sm-2 control-label"
>
报警邮件
<font
color=
"black"
>
*
</font></label>
<div
class=
"col-sm-4"
><input
type=
"text"
class=
"form-control"
name=
"alarmEmail"
placeholder=
"请输入“报警邮件”,多个邮件地址逗号分隔"
maxlength=
"100"
></div>
</div>
<hr>
...
...
xxl-job-admin/src/main/webapp/WEB-INF/template/joblog/joblog.detail.ftl
浏览文件 @
7a781ad3
...
...
@@ -14,7 +14,7 @@
<div
class=
"container"
>
<
#
--
icon
--
>
<div
class=
"navbar-header"
>
<a
href=
"../../index2.html"
class=
"navbar-brand"
><b>
执行日志
</b>
Console
</a>
<a
class=
"navbar-brand"
><b>
执行日志
</b>
Console
</a>
<button
type=
"button"
class=
"navbar-toggle collapsed"
data-toggle=
"collapse"
data-target=
"#navbar-collapse"
>
<i
class=
"fa fa-bars"
></i>
</button>
...
...
xxl-job-admin/src/main/webapp/static/js/jobcode.index.1.js
浏览文件 @
7a781ad3
...
...
@@ -6,18 +6,36 @@ $(function() {
lineNumbers : true,
matchBrackets : true
});*/
var
codeEditor
=
CodeMirror
(
document
.
getElementById
(
"ideWindow"
),
{
mode
:
"text/x-java"
,
lineNumbers
:
true
,
matchBrackets
:
true
,
value
:
$
(
"#version_now"
).
val
()
});
var
codeEditor
;
function
initIde
(
glueType
,
glueSource
)
{
var
ideMode
=
"text/x-java"
;
if
(
'GLUE_GROOVY'
==
glueType
){
ideMode
=
"text/x-java"
;
}
else
if
(
'GLUE_SHELL'
==
glueType
){
ideMode
=
"text/x-sh"
;
}
else
if
(
'GLUE_PYTHON'
==
glueType
){
ideMode
=
"text/x-python"
;
}
codeEditor
=
CodeMirror
(
document
.
getElementById
(
"ideWindow"
),
{
mode
:
ideMode
,
lineNumbers
:
true
,
matchBrackets
:
true
,
value
:
glueSource
});
}
initIde
(
glueType
,
$
(
"#version_now"
).
val
());
// code change
$
(
".source_version"
).
click
(
function
(){
var
glueType
=
$
(
this
).
attr
(
'glueType'
);
var
sourceId
=
$
(
this
).
attr
(
'version'
);
var
temp
=
$
(
"#"
+
sourceId
).
val
();
codeEditor
.
setValue
(
temp
);
codeEditor
.
setValue
(
''
);
initIde
(
glueType
,
temp
);
});
// code source save
...
...
@@ -34,8 +52,8 @@ $(function() {
ComAlert
.
show
(
2
,
"请输入备注"
);
return
;
}
if
(
glueRemark
.
length
<
6
||
glueRemark
.
length
>
100
)
{
ComAlert
.
show
(
2
,
"备注长度应该在
6
至100之间"
);
if
(
glueRemark
.
length
<
4
||
glueRemark
.
length
>
100
)
{
ComAlert
.
show
(
2
,
"备注长度应该在
4
至100之间"
);
return
;
}
...
...
xxl-job-admin/src/main/webapp/static/js/jobinfo.index.1.js
浏览文件 @
7a781ad3
...
...
@@ -239,9 +239,6 @@ $(function() {
},
jobCron
:
{
required
:
true
},
alarmEmail
:
{
required
:
true
},
author
:
{
required
:
true
...
...
@@ -254,9 +251,6 @@ $(function() {
jobCron
:
{
required
:
"请输入“Cron”."
},
alarmEmail
:
{
required
:
"请输入“报警邮件”."
},
author
:
{
required
:
"请输入“负责人”."
}
...
...
@@ -349,9 +343,6 @@ $(function() {
jobCron
:
{
required
:
true
},
alarmEmail
:
{
required
:
true
},
author
:
{
required
:
true
}
...
...
@@ -363,9 +354,6 @@ $(function() {
jobCron
:
{
required
:
"请输入“Cron”."
},
alarmEmail
:
{
required
:
"请输入“报警邮件”."
},
author
:
{
required
:
"请输入“负责人”."
}
...
...
xxl-job-admin/src/main/webapp/static/plugins/codemirror/mode/clike/test.js
deleted
100644 → 0
浏览文件 @
548426e9
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE
(
function
()
{
var
mode
=
CodeMirror
.
getMode
({
indentUnit
:
2
},
"text/x-c"
);
function
MT
(
name
)
{
test
.
mode
(
name
,
mode
,
Array
.
prototype
.
slice
.
call
(
arguments
,
1
));
}
MT
(
"indent"
,
"[variable-3 void] [def foo]([variable-3 void*] [variable a], [variable-3 int] [variable b]) {"
,
" [variable-3 int] [variable c] [operator =] [variable b] [operator +]"
,
" [number 1];"
,
" [keyword return] [operator *][variable a];"
,
"}"
);
MT
(
"indent_switch"
,
"[keyword switch] ([variable x]) {"
,
" [keyword case] [number 10]:"
,
" [keyword return] [number 20];"
,
" [keyword default]:"
,
" [variable printf]([string
\"
foo %c
\"
], [variable x]);"
,
"}"
);
MT
(
"def"
,
"[variable-3 void] [def foo]() {}"
,
"[keyword struct] [def bar]{}"
,
"[variable-3 int] [variable-3 *][def baz]() {}"
);
MT
(
"double_block"
,
"[keyword for] (;;)"
,
" [keyword for] (;;)"
,
" [variable x][operator ++];"
,
"[keyword return];"
);
MT
(
"preprocessor"
,
"[meta #define FOO 3]"
,
"[variable-3 int] [variable foo];"
,
"[meta #define BAR
\\
]"
,
"[meta 4]"
,
"[variable-3 unsigned] [variable-3 int] [variable bar] [operator =] [number 8];"
,
"[meta #include <baz> ][comment // comment]"
)
var
mode_cpp
=
CodeMirror
.
getMode
({
indentUnit
:
2
},
"text/x-c++src"
);
function
MTCPP
(
name
)
{
test
.
mode
(
name
,
mode_cpp
,
Array
.
prototype
.
slice
.
call
(
arguments
,
1
));
}
MTCPP
(
"cpp14_literal"
,
"[number 10'000];"
,
"[number 0b10'000];"
,
"[number 0x10'000];"
,
"[string '100000'];"
);
})();
xxl-job-admin/src/main/webapp/static/plugins/codemirror/mode/groovy/groovy.js
deleted
100644 → 0
浏览文件 @
548426e9
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE
(
function
(
mod
)
{
if
(
typeof
exports
==
"object"
&&
typeof
module
==
"object"
)
// CommonJS
mod
(
require
(
"../../lib/codemirror"
));
else
if
(
typeof
define
==
"function"
&&
define
.
amd
)
// AMD
define
([
"../../lib/codemirror"
],
mod
);
else
// Plain browser env
mod
(
CodeMirror
);
})(
function
(
CodeMirror
)
{
"use strict"
;
CodeMirror
.
defineMode
(
"groovy"
,
function
(
config
)
{
function
words
(
str
)
{
var
obj
=
{},
words
=
str
.
split
(
" "
);
for
(
var
i
=
0
;
i
<
words
.
length
;
++
i
)
obj
[
words
[
i
]]
=
true
;
return
obj
;
}
var
keywords
=
words
(
"abstract as assert boolean break byte case catch char class const continue def default "
+
"do double else enum extends final finally float for goto if implements import in "
+
"instanceof int interface long native new package private protected public return "
+
"short static strictfp super switch synchronized threadsafe throw throws transient "
+
"try void volatile while"
);
var
blockKeywords
=
words
(
"catch class do else finally for if switch try while enum interface def"
);
var
standaloneKeywords
=
words
(
"return break continue"
);
var
atoms
=
words
(
"null true false this"
);
var
curPunc
;
function
tokenBase
(
stream
,
state
)
{
var
ch
=
stream
.
next
();
if
(
ch
==
'"'
||
ch
==
"'"
)
{
return
startString
(
ch
,
stream
,
state
);
}
if
(
/
[\[\]
{}
\(\)
,;
\:\.]
/
.
test
(
ch
))
{
curPunc
=
ch
;
return
null
;
}
if
(
/
\d
/
.
test
(
ch
))
{
stream
.
eatWhile
(
/
[\w\.]
/
);
if
(
stream
.
eat
(
/eE/
))
{
stream
.
eat
(
/
\+\-
/
);
stream
.
eatWhile
(
/
\d
/
);
}
return
"number"
;
}
if
(
ch
==
"/"
)
{
if
(
stream
.
eat
(
"*"
))
{
state
.
tokenize
.
push
(
tokenComment
);
return
tokenComment
(
stream
,
state
);
}
if
(
stream
.
eat
(
"/"
))
{
stream
.
skipToEnd
();
return
"comment"
;
}
if
(
expectExpression
(
state
.
lastToken
,
false
))
{
return
startString
(
ch
,
stream
,
state
);
}
}
if
(
ch
==
"-"
&&
stream
.
eat
(
">"
))
{
curPunc
=
"->"
;
return
null
;
}
if
(
/
[
+
\-
*&%=<>!?|
\/
~
]
/
.
test
(
ch
))
{
stream
.
eatWhile
(
/
[
+
\-
*&%=<>|~
]
/
);
return
"operator"
;
}
stream
.
eatWhile
(
/
[\w\$
_
]
/
);
if
(
ch
==
"@"
)
{
stream
.
eatWhile
(
/
[\w\$
_
\.]
/
);
return
"meta"
;
}
if
(
state
.
lastToken
==
"."
)
return
"property"
;
if
(
stream
.
eat
(
":"
))
{
curPunc
=
"proplabel"
;
return
"property"
;
}
var
cur
=
stream
.
current
();
if
(
atoms
.
propertyIsEnumerable
(
cur
))
{
return
"atom"
;
}
if
(
keywords
.
propertyIsEnumerable
(
cur
))
{
if
(
blockKeywords
.
propertyIsEnumerable
(
cur
))
curPunc
=
"newstatement"
;
else
if
(
standaloneKeywords
.
propertyIsEnumerable
(
cur
))
curPunc
=
"standalone"
;
return
"keyword"
;
}
return
"variable"
;
}
tokenBase
.
isBase
=
true
;
function
startString
(
quote
,
stream
,
state
)
{
var
tripleQuoted
=
false
;
if
(
quote
!=
"/"
&&
stream
.
eat
(
quote
))
{
if
(
stream
.
eat
(
quote
))
tripleQuoted
=
true
;
else
return
"string"
;
}
function
t
(
stream
,
state
)
{
var
escaped
=
false
,
next
,
end
=
!
tripleQuoted
;
while
((
next
=
stream
.
next
())
!=
null
)
{
if
(
next
==
quote
&&
!
escaped
)
{
if
(
!
tripleQuoted
)
{
break
;
}
if
(
stream
.
match
(
quote
+
quote
))
{
end
=
true
;
break
;
}
}
if
(
quote
==
'"'
&&
next
==
"$"
&&
!
escaped
&&
stream
.
eat
(
"{"
))
{
state
.
tokenize
.
push
(
tokenBaseUntilBrace
());
return
"string"
;
}
escaped
=
!
escaped
&&
next
==
"
\
\"
;
}
if (end) state.tokenize.pop();
return "
string
";
}
state.tokenize.push(t);
return t(stream, state);
}
function tokenBaseUntilBrace() {
var depth = 1;
function t(stream, state) {
if (stream.peek() == "
}
") {
depth--;
if (depth == 0) {
state.tokenize.pop();
return state.tokenize[state.tokenize.length-1](stream, state);
}
} else if (stream.peek() == "
{
") {
depth++;
}
return tokenBase(stream, state);
}
t.isBase = true;
return t;
}
function tokenComment(stream, state) {
var maybeEnd = false, ch;
while (ch = stream.next()) {
if (ch == "
/
" && maybeEnd) {
state.tokenize.pop();
break;
}
maybeEnd = (ch == "
*
");
}
return "
comment
";
}
function expectExpression(last, newline) {
return !last || last == "
operator
" || last == "
->
" || /[
\
.
\
[
\
{
\
(,;:]/.test(last) ||
last == "
newstatement
" || last == "
keyword
" || last == "
proplabel
" ||
(last == "
standalone
" && !newline);
}
function Context(indented, column, type, align, prev) {
this.indented = indented;
this.column = column;
this.type = type;
this.align = align;
this.prev = prev;
}
function pushContext(state, col, type) {
return state.context = new Context(state.indented, col, type, null, state.context);
}
function popContext(state) {
var t = state.context.type;
if (t == "
)
" || t == "
]
" || t == "
}
")
state.indented = state.context.indented;
return state.context = state.context.prev;
}
// Interface
return {
startState: function(basecolumn) {
return {
tokenize: [tokenBase],
context: new Context((basecolumn || 0) - config.indentUnit, 0, "
top
", false),
indented: 0,
startOfLine: true,
lastToken: null
};
},
token: function(stream, state) {
var ctx = state.context;
if (stream.sol()) {
if (ctx.align == null) ctx.align = false;
state.indented = stream.indentation();
state.startOfLine = true;
// Automatic semicolon insertion
if (ctx.type == "
statement
" && !expectExpression(state.lastToken, true)) {
popContext(state); ctx = state.context;
}
}
if (stream.eatSpace()) return null;
curPunc = null;
var style = state.tokenize[state.tokenize.length-1](stream, state);
if (style == "
comment
") return style;
if (ctx.align == null) ctx.align = true;
if ((curPunc == "
;
" || curPunc == "
:
") && ctx.type == "
statement
") popContext(state);
// Handle indentation for {x ->
\n
... }
else if (curPunc == "
->
" && ctx.type == "
statement
" && ctx.prev.type == "
}
") {
popContext(state);
state.context.align = false;
}
else if (curPunc == "
{
") pushContext(state, stream.column(), "
}
");
else if (curPunc == "
[
") pushContext(state, stream.column(), "
]
");
else if (curPunc == "
(
") pushContext(state, stream.column(), "
)
");
else if (curPunc == "
}
") {
while (ctx.type == "
statement
") ctx = popContext(state);
if (ctx.type == "
}
") ctx = popContext(state);
while (ctx.type == "
statement
") ctx = popContext(state);
}
else if (curPunc == ctx.type) popContext(state);
else if (ctx.type == "
}
" || ctx.type == "
top
" || (ctx.type == "
statement
" && curPunc == "
newstatement
"))
pushContext(state, stream.column(), "
statement
");
state.startOfLine = false;
state.lastToken = curPunc || style;
return style;
},
indent: function(state, textAfter) {
if (!state.tokenize[state.tokenize.length-1].isBase) return 0;
var firstChar = textAfter && textAfter.charAt(0), ctx = state.context;
if (ctx.type == "
statement
" && !expectExpression(state.lastToken, true)) ctx = ctx.prev;
var closing = firstChar == ctx.type;
if (ctx.type == "
statement
") return ctx.indented + (firstChar == "
{
" ? 0 : config.indentUnit);
else if (ctx.align) return ctx.column + (closing ? 0 : 1);
else return ctx.indented + (closing ? 0 : config.indentUnit);
},
electricChars: "
{}
",
closeBrackets: {triples: "
'
\
""},
fold: "brace"
};
});
CodeMirror.defineMIME("text/x-groovy", "groovy");
});
xxl-job-admin/src/main/webapp/static/plugins/codemirror/mode/python/python.js
0 → 100755
浏览文件 @
7a781ad3
差异被折叠。
点击展开。
xxl-job-admin/src/main/webapp/static/plugins/codemirror/mode/shell/shell.js
0 → 100755
浏览文件 @
7a781ad3
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE
(
function
(
mod
)
{
if
(
typeof
exports
==
"object"
&&
typeof
module
==
"object"
)
// CommonJS
mod
(
require
(
"../../lib/codemirror"
));
else
if
(
typeof
define
==
"function"
&&
define
.
amd
)
// AMD
define
([
"../../lib/codemirror"
],
mod
);
else
// Plain browser env
mod
(
CodeMirror
);
})(
function
(
CodeMirror
)
{
"use strict"
;
CodeMirror
.
defineMode
(
'shell'
,
function
()
{
var
words
=
{};
function
define
(
style
,
string
)
{
var
split
=
string
.
split
(
' '
);
for
(
var
i
=
0
;
i
<
split
.
length
;
i
++
)
{
words
[
split
[
i
]]
=
style
;
}
};
// Atoms
define
(
'atom'
,
'true false'
);
// Keywords
define
(
'keyword'
,
'if then do else elif while until for in esac fi fin '
+
'fil done exit set unset export function'
);
// Commands
define
(
'builtin'
,
'ab awk bash beep cat cc cd chown chmod chroot clear cp '
+
'curl cut diff echo find gawk gcc get git grep kill killall ln ls make '
+
'mkdir openssl mv nc node npm ping ps restart rm rmdir sed service sh '
+
'shopt shred source sort sleep ssh start stop su sudo tee telnet top '
+
'touch vi vim wall wc wget who write yes zsh'
);
function
tokenBase
(
stream
,
state
)
{
if
(
stream
.
eatSpace
())
return
null
;
var
sol
=
stream
.
sol
();
var
ch
=
stream
.
next
();
if
(
ch
===
'
\
\'
) {
stream.next();
return null;
}
if (ch === '
\
''
||
ch
===
'"'
||
ch
===
'`'
)
{
state
.
tokens
.
unshift
(
tokenString
(
ch
,
ch
===
"`"
?
"quote"
:
"string"
));
return
tokenize
(
stream
,
state
);
}
if
(
ch
===
'#'
)
{
if
(
sol
&&
stream
.
eat
(
'!'
))
{
stream
.
skipToEnd
();
return
'meta'
;
// 'comment'?
}
stream
.
skipToEnd
();
return
'comment'
;
}
if
(
ch
===
'$'
)
{
state
.
tokens
.
unshift
(
tokenDollar
);
return
tokenize
(
stream
,
state
);
}
if
(
ch
===
'+'
||
ch
===
'='
)
{
return
'operator'
;
}
if
(
ch
===
'-'
)
{
stream
.
eat
(
'-'
);
stream
.
eatWhile
(
/
\w
/
);
return
'attribute'
;
}
if
(
/
\d
/
.
test
(
ch
))
{
stream
.
eatWhile
(
/
\d
/
);
if
(
stream
.
eol
()
||
!
/
\w
/
.
test
(
stream
.
peek
()))
{
return
'number'
;
}
}
stream
.
eatWhile
(
/
[\w
-
]
/
);
var
cur
=
stream
.
current
();
if
(
stream
.
peek
()
===
'='
&&
/
\w
+/
.
test
(
cur
))
return
'def'
;
return
words
.
hasOwnProperty
(
cur
)
?
words
[
cur
]
:
null
;
}
function
tokenString
(
quote
,
style
)
{
var
close
=
quote
==
"("
?
")"
:
quote
==
"{"
?
"}"
:
quote
return
function
(
stream
,
state
)
{
var
next
,
end
=
false
,
escaped
=
false
;
while
((
next
=
stream
.
next
())
!=
null
)
{
if
(
next
===
close
&&
!
escaped
)
{
end
=
true
;
break
;
}
if
(
next
===
'$'
&&
!
escaped
&&
quote
!==
"'"
)
{
escaped
=
true
;
stream
.
backUp
(
1
);
state
.
tokens
.
unshift
(
tokenDollar
);
break
;
}
if
(
!
escaped
&&
next
===
quote
&&
quote
!==
close
)
{
state
.
tokens
.
unshift
(
tokenString
(
quote
,
style
))
return
tokenize
(
stream
,
state
)
}
escaped
=
!
escaped
&&
next
===
'
\
\'
;
}
if (end || !escaped) state.tokens.shift();
return style;
};
};
var tokenDollar = function(stream, state) {
if (state.tokens.length > 1) stream.eat('
$
');
var ch = stream.next()
if (/['
"({]/.test(ch)) {
state.tokens[0] = tokenString(ch, ch == "
(
" ? "
quote
" : ch == "
{
" ? "
def
" : "
string
");
return tokenize(stream, state);
}
if (!/
\
d/.test(ch)) stream.eatWhile(/
\
w/);
state.tokens.shift();
return 'def';
};
function tokenize(stream, state) {
return (state.tokens[0] || tokenBase) (stream, state);
};
return {
startState: function() {return {tokens:[]};},
token: function(stream, state) {
return tokenize(stream, state);
},
closeBrackets: "
()[]{}
''
\
"
\"
``"
,
lineComment
:
'#'
,
fold
:
"brace"
};
});
CodeMirror
.
defineMIME
(
'text/x-sh'
,
'shell'
);
});
xxl-job-core/src/main/java/com/xxl/job/core/thread/JobThread.java
浏览文件 @
7a781ad3
...
...
@@ -87,6 +87,9 @@ public class JobThread extends Thread{
executeResult
=
ReturnT
.
FAIL
;
}
}
catch
(
Exception
e
)
{
if
(
toStop
)
{
logger
.
error
(
"----------- xxl-job toStop, stopReason:{}"
,
stopReason
);
}
logger
.
error
(
"JobThread Exception:"
,
e
);
StringWriter
out
=
new
StringWriter
();
e
.
printStackTrace
(
new
PrintWriter
(
out
));
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论