Sfoglia il codice sorgente

1、GLUE版本逻辑调整;

xueli.xue 8 anni fa
parent
commit
7a781ad371

+ 17 - 10
xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobCodeController.java Vedi File

@@ -5,6 +5,7 @@ import com.xxl.job.admin.core.model.XxlJobLogGlue;
5 5
 import com.xxl.job.admin.dao.IXxlJobInfoDao;
6 6
 import com.xxl.job.admin.dao.IXxlJobLogGlueDao;
7 7
 import com.xxl.job.core.biz.model.ReturnT;
8
+import com.xxl.job.core.glue.GlueTypeEnum;
8 9
 import org.springframework.stereotype.Controller;
9 10
 import org.springframework.ui.Model;
10 11
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -35,6 +36,12 @@ public class JobCodeController {
35 36
 		if (jobInfo == null) {
36 37
 			throw new RuntimeException("抱歉,任务不存在.");
37 38
 		}
39
+		if (GlueTypeEnum.BEAN == GlueTypeEnum.match(jobInfo.getGlueType())) {
40
+			throw new RuntimeException("该任务非GLUE模式.");
41
+		}
42
+
43
+		// Glue类型-字典
44
+		model.addAttribute("GlueTypeEnum", GlueTypeEnum.values());
38 45
 
39 46
 		model.addAttribute("jobInfo", jobInfo);
40 47
 		model.addAttribute("jobLogGlues", jobLogGlues);
@@ -48,28 +55,28 @@ public class JobCodeController {
48 55
 		if (glueRemark==null) {
49 56
 			return new ReturnT<String>(500, "请输入备注");
50 57
 		}
51
-		if (glueRemark.length()<6 || glueRemark.length()>100) {
52
-			return new ReturnT<String>(500, "备注长度应该在6至100之间");
58
+		if (glueRemark.length()<4 || glueRemark.length()>100) {
59
+			return new ReturnT<String>(500, "备注长度应该在4至100之间");
53 60
 		}
54 61
 		XxlJobInfo exists_jobInfo = xxlJobInfoDao.loadById(id);
55 62
 		if (exists_jobInfo == null) {
56 63
 			return new ReturnT<String>(500, "参数异常");
57 64
 		}
58 65
 		
59
-		// log old code
60
-		XxlJobLogGlue xxlJobLogGlue = new XxlJobLogGlue();
61
-		xxlJobLogGlue.setJobId(exists_jobInfo.getId());
62
-		xxlJobLogGlue.setGlueType(exists_jobInfo.getGlueType());
63
-		xxlJobLogGlue.setGlueSource(exists_jobInfo.getGlueSource());
64
-		xxlJobLogGlue.setGlueRemark(exists_jobInfo.getGlueRemark());
65
-		xxlJobLogGlueDao.save(xxlJobLogGlue);
66
-		
67 66
 		// update new code
68 67
 		exists_jobInfo.setGlueSource(glueSource);
69 68
 		exists_jobInfo.setGlueRemark(glueRemark);
70 69
 		exists_jobInfo.setGlueUpdatetime(new Date());
71 70
 		xxlJobInfoDao.update(exists_jobInfo);
72 71
 
72
+		// log old code
73
+		XxlJobLogGlue xxlJobLogGlue = new XxlJobLogGlue();
74
+		xxlJobLogGlue.setJobId(exists_jobInfo.getId());
75
+		xxlJobLogGlue.setGlueType(exists_jobInfo.getGlueType());
76
+		xxlJobLogGlue.setGlueSource(glueSource);
77
+		xxlJobLogGlue.setGlueRemark(glueRemark);
78
+		xxlJobLogGlueDao.save(xxlJobLogGlue);
79
+
73 80
 		// remove code backup more than 30
74 81
 		xxlJobLogGlueDao.removeOld(exists_jobInfo.getId(), 30);
75 82
 

+ 0 - 6
xxl-job-admin/src/main/java/com/xxl/job/admin/service/impl/XxlJobServiceImpl.java Vedi File

@@ -79,9 +79,6 @@ public class XxlJobServiceImpl implements IXxlJobService {
79 79
 		if (StringUtils.isBlank(jobInfo.getAuthor())) {
80 80
 			return new ReturnT<String>(500, "请输入“负责人”");
81 81
 		}
82
-		if (StringUtils.isBlank(jobInfo.getAlarmEmail())) {
83
-			return new ReturnT<String>(500, "请输入“报警邮件”");
84
-		}
85 82
 		if (ExecutorRouteStrategyEnum.match(jobInfo.getExecutorRouteStrategy(), null) == null) {
86 83
 			return new ReturnT<String>(500, "路由策略非法");
87 84
 		}
@@ -145,9 +142,6 @@ public class XxlJobServiceImpl implements IXxlJobService {
145 142
 		if (StringUtils.isBlank(jobInfo.getAuthor())) {
146 143
 			return new ReturnT<String>(500, "请输入“负责人”");
147 144
 		}
148
-		if (StringUtils.isBlank(jobInfo.getAlarmEmail())) {
149
-			return new ReturnT<String>(500, "请输入“报警邮件”");
150
-		}
151 145
 		if (ExecutorRouteStrategyEnum.match(jobInfo.getExecutorRouteStrategy(), null) == null) {
152 146
 			return new ReturnT<String>(500, "路由策略非法");
153 147
 		}

+ 15 - 4
xxl-job-admin/src/main/webapp/WEB-INF/template/jobcode/jobcode.index.ftl Vedi File

@@ -26,7 +26,7 @@
26 26
                 <div class="container">
27 27
 					<#-- icon -->
28 28
                     <div class="navbar-header">
29
-                        <a href="../../index2.html" class="navbar-brand"><b>Web</b>IDE</a>
29
+                        <a class="navbar-brand"><b>Web</b>IDE</a>
30 30
                         <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar-collapse">
31 31
                             <i class="fa fa-bars"></i>
32 32
                         </button>
@@ -35,7 +35,7 @@
35 35
                     <#-- left nav -->
36 36
                     <div class="collapse navbar-collapse pull-left" id="navbar-collapse">
37 37
                         <ul class="nav navbar-nav">
38
-                            <li class="active" ><a href="javascript:;">任务:${jobInfo.jobDesc}<span class="sr-only">(current)</span></a></li>
38
+                            <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>
39 39
                         </ul>
40 40
                     </div>
41 41
 
@@ -45,11 +45,19 @@
45 45
                             <li class="dropdown">
46 46
                                 <a href="#" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false">版本回溯 <span class="caret"></span></a>
47 47
                                 <ul class="dropdown-menu" role="menu">
48
-                                    <li><a href="javascript:;" class="source_version" version="version_now" >${jobInfo.glueRemark}【OnLine】</a></li>
48
+                                    <li <#if jobLogGlues?exists && jobLogGlues?size gt 0 >style="display: none;"</#if> >
49
+                                        <a href="javascript:;" class="source_version" version="version_now" glueType="${jobInfo.glueType}" >
50
+                                            <#list GlueTypeEnum as item><#if item == jobInfo.glueType>${item.desc}</#if></#list>: ${jobInfo.glueRemark}
51
+                                        </a>
52
+                                    </li>
49 53
                                     <textarea id="version_now" style="display:none;" >${jobInfo.glueSource}</textarea>
50 54
 									<#if jobLogGlues?exists && jobLogGlues?size gt 0 >
51 55
 										<#list jobLogGlues as glue>
52
-                                            <li><a href="javascript:;" class="source_version" version="version_${glue.id}" >${glue.glueRemark}</a></li>
56
+                                            <li>
57
+                                                <a href="javascript:;" class="source_version" version="version_${glue.id}" glueType="${glue.glueType}" >
58
+                                                    <#list GlueTypeEnum as item><#if item == glue.glueType>${item.desc}</#if></#list>: ${glue.glueRemark}
59
+                                                </a>
60
+                                            </li>
53 61
                                             <textarea id="version_${glue.id}" style="display:none;" >${glue.glueSource}</textarea>
54 62
 										</#list>
55 63
 									</#if>
@@ -103,10 +111,13 @@
103 111
 <@netCommon.commonScript />
104 112
 <script src="${request.contextPath}/static/plugins/codemirror/lib/codemirror.js"></script>
105 113
 <script src="${request.contextPath}/static/plugins/codemirror/mode/clike/clike.js"></script>
114
+<script src="${request.contextPath}/static/plugins/codemirror/mode/shell/shell.js"></script>
115
+<script src="${request.contextPath}/static/plugins/codemirror/mode/python/python.js"></script>
106 116
 <script src="${request.contextPath}/static/plugins/codemirror/addon/hint/show-hint.js"></script>
107 117
 <script src="${request.contextPath}/static/plugins/codemirror/addon/hint/anyword-hint.js"></script>
108 118
 <script>
109 119
 var id = '${jobInfo.id}';
120
+var glueType = '${jobInfo.glueType}';
110 121
 </script>
111 122
 <script src="${request.contextPath}/static/js/jobcode.index.1.js"></script>
112 123
 

+ 36 - 4
xxl-job-admin/src/main/webapp/WEB-INF/template/jobinfo/jobinfo.index.ftl Vedi File

@@ -154,10 +154,10 @@
154 154
                         <div class="col-sm-4"><input type="text" class="form-control" name="childJobKey" placeholder="请输入子任务的任务Key,如存在多个逗号分隔" maxlength="100" ></div>
155 155
                     </div>
156 156
 					<div class="form-group">
157
-						<label for="lastname" class="col-sm-2 control-label">报警邮件<font color="red">*</font></label>
158
-						<div class="col-sm-4"><input type="text" class="form-control" name="alarmEmail" placeholder="请输入“报警邮件”,多个邮件地址逗号分隔" maxlength="100" ></div>
159 157
                         <label for="lastname" class="col-sm-2 control-label">负责人<font color="red">*</font></label>
160 158
                         <div class="col-sm-4"><input type="text" class="form-control" name="author" placeholder="请输入“负责人”" maxlength="50" ></div>
159
+						<label for="lastname" class="col-sm-2 control-label">报警邮件<font color="black">*</font></label>
160
+						<div class="col-sm-4"><input type="text" class="form-control" name="alarmEmail" placeholder="请输入“报警邮件”,多个邮件地址逗号分隔" maxlength="100" ></div>
161 161
 					</div>
162 162
 
163 163
                     <hr>
@@ -189,6 +189,38 @@ public class DemoGlueJobHandler extends IJobHandler {
189 189
 
190 190
 }
191 191
 </textarea>
192
+<textarea name="glueSource_shell" style="display:none;" >
193
+#!/bin/bash
194
+
195
+echo hello shell
196
+
197
+for x in 1 2 3 4
198
+do
199
+echo number=$x
200
+sleep 1s
201
+done
202
+
203
+echo1 111
204
+printf 666
205
+echo2 222
206
+</textarea>
207
+<textarea name="glueSource_python" style="display:none;" >
208
+#!/usr/bin/python
209
+# -*- coding: UTF-8 -*-
210
+
211
+import logging
212
+import time
213
+
214
+logging.basicConfig(level=logging.DEBUG)
215
+
216
+logging.info('hello python')
217
+
218
+for num in range(0, 3):
219
+	time.sleep(1)
220
+	logging.info('当前序号 :' + str(num) )
221
+
222
+logging.info('Good bye!')
223
+</textarea>
192 224
 					
193 225
 				</form>
194 226
          	</div>
@@ -248,10 +280,10 @@ public class DemoGlueJobHandler extends IJobHandler {
248 280
                         <div class="col-sm-4"><input type="text" class="form-control" name="childJobKey" placeholder="请输入子任务的任务Key,如存在多个逗号分隔" maxlength="100" ></div>
249 281
                     </div>
250 282
                     <div class="form-group">
251
-                        <label for="lastname" class="col-sm-2 control-label">报警邮件<font color="red">*</font></label>
252
-                        <div class="col-sm-4"><input type="text" class="form-control" name="alarmEmail" placeholder="请输入“报警邮件”,多个邮件地址逗号分隔" maxlength="100" ></div>
253 283
                         <label for="lastname" class="col-sm-2 control-label">负责人<font color="red">*</font></label>
254 284
                         <div class="col-sm-4"><input type="text" class="form-control" name="author" placeholder="请输入“负责人”" maxlength="50" ></div>
285
+                        <label for="lastname" class="col-sm-2 control-label">报警邮件<font color="black">*</font></label>
286
+                        <div class="col-sm-4"><input type="text" class="form-control" name="alarmEmail" placeholder="请输入“报警邮件”,多个邮件地址逗号分隔" maxlength="100" ></div>
255 287
                     </div>
256 288
 
257 289
 					<hr>

+ 1 - 1
xxl-job-admin/src/main/webapp/WEB-INF/template/joblog/joblog.detail.ftl Vedi File

@@ -14,7 +14,7 @@
14 14
             <div class="container">
15 15
             <#-- icon -->
16 16
                 <div class="navbar-header">
17
-                    <a href="../../index2.html" class="navbar-brand"><b>执行日志</b>Console</a>
17
+                    <a class="navbar-brand"><b>执行日志</b>Console</a>
18 18
                     <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar-collapse">
19 19
                         <i class="fa fa-bars"></i>
20 20
                     </button>

+ 27 - 9
xxl-job-admin/src/main/webapp/static/js/jobcode.index.1.js Vedi File

@@ -6,18 +6,36 @@ $(function() {
6 6
 		lineNumbers : true,
7 7
 		matchBrackets : true
8 8
 	});*/
9
-	var codeEditor = CodeMirror(document.getElementById("ideWindow"), {
10
-		mode : "text/x-java",
11
-		lineNumbers : true,
12
-		matchBrackets : true,
13
-		value: $("#version_now").val()
14
-	});
9
+
10
+	var codeEditor;
11
+	function initIde(glueType, glueSource) {
12
+		var ideMode = "text/x-java";
13
+		if ('GLUE_GROOVY'==glueType){
14
+			ideMode = "text/x-java";
15
+		} else if ('GLUE_SHELL'==glueType){
16
+			ideMode = "text/x-sh";
17
+		} else if ('GLUE_PYTHON'==glueType){
18
+			ideMode = "text/x-python";
19
+		}
20
+
21
+		codeEditor = CodeMirror(document.getElementById("ideWindow"), {
22
+			mode : ideMode,
23
+			lineNumbers : true,
24
+			matchBrackets : true,
25
+			value: glueSource
26
+		});
27
+	}
28
+
29
+	initIde(glueType, $("#version_now").val());
15 30
 
16 31
 	// code change
17 32
 	$(".source_version").click(function(){
33
+		var glueType = $(this).attr('glueType');
18 34
 		var sourceId = $(this).attr('version');
19 35
 		var temp = $( "#" + sourceId ).val();
20
-		codeEditor.setValue( temp );
36
+
37
+		codeEditor.setValue('');
38
+		initIde(glueType, temp);
21 39
 	});
22 40
 
23 41
 	// code source save
@@ -34,8 +52,8 @@ $(function() {
34 52
 			ComAlert.show(2, "请输入备注");
35 53
 			return;
36 54
 		}
37
-		if (glueRemark.length < 6|| glueRemark.length > 100) {
38
-			ComAlert.show(2, "备注长度应该在6至100之间");
55
+		if (glueRemark.length <4 || glueRemark.length > 100) {
56
+			ComAlert.show(2, "备注长度应该在4至100之间");
39 57
 			return;
40 58
 		}
41 59
 		

+ 0 - 12
xxl-job-admin/src/main/webapp/static/js/jobinfo.index.1.js Vedi File

@@ -240,9 +240,6 @@ $(function() {
240 240
             jobCron : {
241 241
             	required : true
242 242
             },
243
-            alarmEmail : {
244
-            	required : true
245
-            },
246 243
 			author : {
247 244
 				required : true
248 245
 			}
@@ -254,9 +251,6 @@ $(function() {
254 251
             jobCron : {
255 252
             	required :"请输入“Cron”."
256 253
             },
257
-            alarmEmail : {
258
-            	required : "请输入“报警邮件”."
259
-            },
260 254
             author : {
261 255
             	required : "请输入“负责人”."
262 256
             }
@@ -349,9 +343,6 @@ $(function() {
349 343
 			jobCron : {
350 344
 				required : true
351 345
 			},
352
-			alarmEmail : {
353
-				required : true
354
-			},
355 346
 			author : {
356 347
 				required : true
357 348
 			}
@@ -363,9 +354,6 @@ $(function() {
363 354
 			jobCron : {
364 355
 				required :"请输入“Cron”."
365 356
 			},
366
-			alarmEmail : {
367
-				required : "请输入“报警邮件”."
368
-			},
369 357
 			author : {
370 358
 				required : "请输入“负责人”."
371 359
 			}

+ 0 - 51
xxl-job-admin/src/main/webapp/static/plugins/codemirror/mode/clike/test.js Vedi File

@@ -1,51 +0,0 @@
1
-// CodeMirror, copyright (c) by Marijn Haverbeke and others
2
-// Distributed under an MIT license: http://codemirror.net/LICENSE
3
-
4
-(function() {
5
-  var mode = CodeMirror.getMode({indentUnit: 2}, "text/x-c");
6
-  function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); }
7
-
8
-  MT("indent",
9
-     "[variable-3 void] [def foo]([variable-3 void*] [variable a], [variable-3 int] [variable b]) {",
10
-     "  [variable-3 int] [variable c] [operator =] [variable b] [operator +]",
11
-     "    [number 1];",
12
-     "  [keyword return] [operator *][variable a];",
13
-     "}");
14
-
15
-  MT("indent_switch",
16
-     "[keyword switch] ([variable x]) {",
17
-     "  [keyword case] [number 10]:",
18
-     "    [keyword return] [number 20];",
19
-     "  [keyword default]:",
20
-     "    [variable printf]([string \"foo %c\"], [variable x]);",
21
-     "}");
22
-
23
-  MT("def",
24
-     "[variable-3 void] [def foo]() {}",
25
-     "[keyword struct] [def bar]{}",
26
-     "[variable-3 int] [variable-3 *][def baz]() {}");
27
-
28
-  MT("double_block",
29
-     "[keyword for] (;;)",
30
-     "  [keyword for] (;;)",
31
-     "    [variable x][operator ++];",
32
-     "[keyword return];");
33
-
34
-  MT("preprocessor",
35
-     "[meta #define FOO 3]",
36
-     "[variable-3 int] [variable foo];",
37
-     "[meta #define BAR\\]",
38
-     "[meta 4]",
39
-     "[variable-3 unsigned] [variable-3 int] [variable bar] [operator =] [number 8];",
40
-     "[meta #include <baz> ][comment // comment]")
41
-
42
-
43
-  var mode_cpp = CodeMirror.getMode({indentUnit: 2}, "text/x-c++src");
44
-  function MTCPP(name) { test.mode(name, mode_cpp, Array.prototype.slice.call(arguments, 1)); }
45
-
46
-  MTCPP("cpp14_literal",
47
-    "[number 10'000];",
48
-    "[number 0b10'000];",
49
-    "[number 0x10'000];",
50
-    "[string '100000'];");
51
-})();

+ 0 - 230
xxl-job-admin/src/main/webapp/static/plugins/codemirror/mode/groovy/groovy.js Vedi File

@@ -1,230 +0,0 @@
1
-// CodeMirror, copyright (c) by Marijn Haverbeke and others
2
-// Distributed under an MIT license: http://codemirror.net/LICENSE
3
-
4
-(function(mod) {
5
-  if (typeof exports == "object" && typeof module == "object") // CommonJS
6
-    mod(require("../../lib/codemirror"));
7
-  else if (typeof define == "function" && define.amd) // AMD
8
-    define(["../../lib/codemirror"], mod);
9
-  else // Plain browser env
10
-    mod(CodeMirror);
11
-})(function(CodeMirror) {
12
-"use strict";
13
-
14
-CodeMirror.defineMode("groovy", function(config) {
15
-  function words(str) {
16
-    var obj = {}, words = str.split(" ");
17
-    for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
18
-    return obj;
19
-  }
20
-  var keywords = words(
21
-    "abstract as assert boolean break byte case catch char class const continue def default " +
22
-    "do double else enum extends final finally float for goto if implements import in " +
23
-    "instanceof int interface long native new package private protected public return " +
24
-    "short static strictfp super switch synchronized threadsafe throw throws transient " +
25
-    "try void volatile while");
26
-  var blockKeywords = words("catch class do else finally for if switch try while enum interface def");
27
-  var standaloneKeywords = words("return break continue");
28
-  var atoms = words("null true false this");
29
-
30
-  var curPunc;
31
-  function tokenBase(stream, state) {
32
-    var ch = stream.next();
33
-    if (ch == '"' || ch == "'") {
34
-      return startString(ch, stream, state);
35
-    }
36
-    if (/[\[\]{}\(\),;\:\.]/.test(ch)) {
37
-      curPunc = ch;
38
-      return null;
39
-    }
40
-    if (/\d/.test(ch)) {
41
-      stream.eatWhile(/[\w\.]/);
42
-      if (stream.eat(/eE/)) { stream.eat(/\+\-/); stream.eatWhile(/\d/); }
43
-      return "number";
44
-    }
45
-    if (ch == "/") {
46
-      if (stream.eat("*")) {
47
-        state.tokenize.push(tokenComment);
48
-        return tokenComment(stream, state);
49
-      }
50
-      if (stream.eat("/")) {
51
-        stream.skipToEnd();
52
-        return "comment";
53
-      }
54
-      if (expectExpression(state.lastToken, false)) {
55
-        return startString(ch, stream, state);
56
-      }
57
-    }
58
-    if (ch == "-" && stream.eat(">")) {
59
-      curPunc = "->";
60
-      return null;
61
-    }
62
-    if (/[+\-*&%=<>!?|\/~]/.test(ch)) {
63
-      stream.eatWhile(/[+\-*&%=<>|~]/);
64
-      return "operator";
65
-    }
66
-    stream.eatWhile(/[\w\$_]/);
67
-    if (ch == "@") { stream.eatWhile(/[\w\$_\.]/); return "meta"; }
68
-    if (state.lastToken == ".") return "property";
69
-    if (stream.eat(":")) { curPunc = "proplabel"; return "property"; }
70
-    var cur = stream.current();
71
-    if (atoms.propertyIsEnumerable(cur)) { return "atom"; }
72
-    if (keywords.propertyIsEnumerable(cur)) {
73
-      if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement";
74
-      else if (standaloneKeywords.propertyIsEnumerable(cur)) curPunc = "standalone";
75
-      return "keyword";
76
-    }
77
-    return "variable";
78
-  }
79
-  tokenBase.isBase = true;
80
-
81
-  function startString(quote, stream, state) {
82
-    var tripleQuoted = false;
83
-    if (quote != "/" && stream.eat(quote)) {
84
-      if (stream.eat(quote)) tripleQuoted = true;
85
-      else return "string";
86
-    }
87
-    function t(stream, state) {
88
-      var escaped = false, next, end = !tripleQuoted;
89
-      while ((next = stream.next()) != null) {
90
-        if (next == quote && !escaped) {
91
-          if (!tripleQuoted) { break; }
92
-          if (stream.match(quote + quote)) { end = true; break; }
93
-        }
94
-        if (quote == '"' && next == "$" && !escaped && stream.eat("{")) {
95
-          state.tokenize.push(tokenBaseUntilBrace());
96
-          return "string";
97
-        }
98
-        escaped = !escaped && next == "\\";
99
-      }
100
-      if (end) state.tokenize.pop();
101
-      return "string";
102
-    }
103
-    state.tokenize.push(t);
104
-    return t(stream, state);
105
-  }
106
-
107
-  function tokenBaseUntilBrace() {
108
-    var depth = 1;
109
-    function t(stream, state) {
110
-      if (stream.peek() == "}") {
111
-        depth--;
112
-        if (depth == 0) {
113
-          state.tokenize.pop();
114
-          return state.tokenize[state.tokenize.length-1](stream, state);
115
-        }
116
-      } else if (stream.peek() == "{") {
117
-        depth++;
118
-      }
119
-      return tokenBase(stream, state);
120
-    }
121
-    t.isBase = true;
122
-    return t;
123
-  }
124
-
125
-  function tokenComment(stream, state) {
126
-    var maybeEnd = false, ch;
127
-    while (ch = stream.next()) {
128
-      if (ch == "/" && maybeEnd) {
129
-        state.tokenize.pop();
130
-        break;
131
-      }
132
-      maybeEnd = (ch == "*");
133
-    }
134
-    return "comment";
135
-  }
136
-
137
-  function expectExpression(last, newline) {
138
-    return !last || last == "operator" || last == "->" || /[\.\[\{\(,;:]/.test(last) ||
139
-      last == "newstatement" || last == "keyword" || last == "proplabel" ||
140
-      (last == "standalone" && !newline);
141
-  }
142
-
143
-  function Context(indented, column, type, align, prev) {
144
-    this.indented = indented;
145
-    this.column = column;
146
-    this.type = type;
147
-    this.align = align;
148
-    this.prev = prev;
149
-  }
150
-  function pushContext(state, col, type) {
151
-    return state.context = new Context(state.indented, col, type, null, state.context);
152
-  }
153
-  function popContext(state) {
154
-    var t = state.context.type;
155
-    if (t == ")" || t == "]" || t == "}")
156
-      state.indented = state.context.indented;
157
-    return state.context = state.context.prev;
158
-  }
159
-
160
-  // Interface
161
-
162
-  return {
163
-    startState: function(basecolumn) {
164
-      return {
165
-        tokenize: [tokenBase],
166
-        context: new Context((basecolumn || 0) - config.indentUnit, 0, "top", false),
167
-        indented: 0,
168
-        startOfLine: true,
169
-        lastToken: null
170
-      };
171
-    },
172
-
173
-    token: function(stream, state) {
174
-      var ctx = state.context;
175
-      if (stream.sol()) {
176
-        if (ctx.align == null) ctx.align = false;
177
-        state.indented = stream.indentation();
178
-        state.startOfLine = true;
179
-        // Automatic semicolon insertion
180
-        if (ctx.type == "statement" && !expectExpression(state.lastToken, true)) {
181
-          popContext(state); ctx = state.context;
182
-        }
183
-      }
184
-      if (stream.eatSpace()) return null;
185
-      curPunc = null;
186
-      var style = state.tokenize[state.tokenize.length-1](stream, state);
187
-      if (style == "comment") return style;
188
-      if (ctx.align == null) ctx.align = true;
189
-
190
-      if ((curPunc == ";" || curPunc == ":") && ctx.type == "statement") popContext(state);
191
-      // Handle indentation for {x -> \n ... }
192
-      else if (curPunc == "->" && ctx.type == "statement" && ctx.prev.type == "}") {
193
-        popContext(state);
194
-        state.context.align = false;
195
-      }
196
-      else if (curPunc == "{") pushContext(state, stream.column(), "}");
197
-      else if (curPunc == "[") pushContext(state, stream.column(), "]");
198
-      else if (curPunc == "(") pushContext(state, stream.column(), ")");
199
-      else if (curPunc == "}") {
200
-        while (ctx.type == "statement") ctx = popContext(state);
201
-        if (ctx.type == "}") ctx = popContext(state);
202
-        while (ctx.type == "statement") ctx = popContext(state);
203
-      }
204
-      else if (curPunc == ctx.type) popContext(state);
205
-      else if (ctx.type == "}" || ctx.type == "top" || (ctx.type == "statement" && curPunc == "newstatement"))
206
-        pushContext(state, stream.column(), "statement");
207
-      state.startOfLine = false;
208
-      state.lastToken = curPunc || style;
209
-      return style;
210
-    },
211
-
212
-    indent: function(state, textAfter) {
213
-      if (!state.tokenize[state.tokenize.length-1].isBase) return 0;
214
-      var firstChar = textAfter && textAfter.charAt(0), ctx = state.context;
215
-      if (ctx.type == "statement" && !expectExpression(state.lastToken, true)) ctx = ctx.prev;
216
-      var closing = firstChar == ctx.type;
217
-      if (ctx.type == "statement") return ctx.indented + (firstChar == "{" ? 0 : config.indentUnit);
218
-      else if (ctx.align) return ctx.column + (closing ? 0 : 1);
219
-      else return ctx.indented + (closing ? 0 : config.indentUnit);
220
-    },
221
-
222
-    electricChars: "{}",
223
-    closeBrackets: {triples: "'\""},
224
-    fold: "brace"
225
-  };
226
-});
227
-
228
-CodeMirror.defineMIME("text/x-groovy", "groovy");
229
-
230
-});

+ 340 - 0
xxl-job-admin/src/main/webapp/static/plugins/codemirror/mode/python/python.js Vedi File

@@ -0,0 +1,340 @@
1
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
2
+// Distributed under an MIT license: http://codemirror.net/LICENSE
3
+
4
+(function(mod) {
5
+  if (typeof exports == "object" && typeof module == "object") // CommonJS
6
+    mod(require("../../lib/codemirror"));
7
+  else if (typeof define == "function" && define.amd) // AMD
8
+    define(["../../lib/codemirror"], mod);
9
+  else // Plain browser env
10
+    mod(CodeMirror);
11
+})(function(CodeMirror) {
12
+  "use strict";
13
+
14
+  function wordRegexp(words) {
15
+    return new RegExp("^((" + words.join(")|(") + "))\\b");
16
+  }
17
+
18
+  var wordOperators = wordRegexp(["and", "or", "not", "is"]);
19
+  var commonKeywords = ["as", "assert", "break", "class", "continue",
20
+                        "def", "del", "elif", "else", "except", "finally",
21
+                        "for", "from", "global", "if", "import",
22
+                        "lambda", "pass", "raise", "return",
23
+                        "try", "while", "with", "yield", "in"];
24
+  var commonBuiltins = ["abs", "all", "any", "bin", "bool", "bytearray", "callable", "chr",
25
+                        "classmethod", "compile", "complex", "delattr", "dict", "dir", "divmod",
26
+                        "enumerate", "eval", "filter", "float", "format", "frozenset",
27
+                        "getattr", "globals", "hasattr", "hash", "help", "hex", "id",
28
+                        "input", "int", "isinstance", "issubclass", "iter", "len",
29
+                        "list", "locals", "map", "max", "memoryview", "min", "next",
30
+                        "object", "oct", "open", "ord", "pow", "property", "range",
31
+                        "repr", "reversed", "round", "set", "setattr", "slice",
32
+                        "sorted", "staticmethod", "str", "sum", "super", "tuple",
33
+                        "type", "vars", "zip", "__import__", "NotImplemented",
34
+                        "Ellipsis", "__debug__"];
35
+  CodeMirror.registerHelper("hintWords", "python", commonKeywords.concat(commonBuiltins));
36
+
37
+  function top(state) {
38
+    return state.scopes[state.scopes.length - 1];
39
+  }
40
+
41
+  CodeMirror.defineMode("python", function(conf, parserConf) {
42
+    var ERRORCLASS = "error";
43
+
44
+    var singleDelimiters = parserConf.singleDelimiters || /^[\(\)\[\]\{\}@,:`=;\.]/;
45
+    var doubleOperators = parserConf.doubleOperators || /^([!<>]==|<>|<<|>>|\/\/|\*\*)/;
46
+    var doubleDelimiters = parserConf.doubleDelimiters || /^(\+=|\-=|\*=|%=|\/=|&=|\|=|\^=)/;
47
+    var tripleDelimiters = parserConf.tripleDelimiters || /^(\/\/=|>>=|<<=|\*\*=)/;
48
+
49
+    var hangingIndent = parserConf.hangingIndent || conf.indentUnit;
50
+
51
+    var myKeywords = commonKeywords, myBuiltins = commonBuiltins;
52
+    if (parserConf.extra_keywords != undefined)
53
+      myKeywords = myKeywords.concat(parserConf.extra_keywords);
54
+
55
+    if (parserConf.extra_builtins != undefined)
56
+      myBuiltins = myBuiltins.concat(parserConf.extra_builtins);
57
+
58
+    var py3 = !(parserConf.version && Number(parserConf.version) < 3)
59
+    if (py3) {
60
+      // since http://legacy.python.org/dev/peps/pep-0465/ @ is also an operator
61
+      var singleOperators = parserConf.singleOperators || /^[\+\-\*\/%&|\^~<>!@]/;
62
+      var identifiers = parserConf.identifiers|| /^[_A-Za-z\u00A1-\uFFFF][_A-Za-z0-9\u00A1-\uFFFF]*/;
63
+      myKeywords = myKeywords.concat(["nonlocal", "False", "True", "None", "async", "await"]);
64
+      myBuiltins = myBuiltins.concat(["ascii", "bytes", "exec", "print"]);
65
+      var stringPrefixes = new RegExp("^(([rbuf]|(br))?('{3}|\"{3}|['\"]))", "i");
66
+    } else {
67
+      var singleOperators = parserConf.singleOperators || /^[\+\-\*\/%&|\^~<>!]/;
68
+      var identifiers = parserConf.identifiers|| /^[_A-Za-z][_A-Za-z0-9]*/;
69
+      myKeywords = myKeywords.concat(["exec", "print"]);
70
+      myBuiltins = myBuiltins.concat(["apply", "basestring", "buffer", "cmp", "coerce", "execfile",
71
+                                      "file", "intern", "long", "raw_input", "reduce", "reload",
72
+                                      "unichr", "unicode", "xrange", "False", "True", "None"]);
73
+      var stringPrefixes = new RegExp("^(([rubf]|(ur)|(br))?('{3}|\"{3}|['\"]))", "i");
74
+    }
75
+    var keywords = wordRegexp(myKeywords);
76
+    var builtins = wordRegexp(myBuiltins);
77
+
78
+    // tokenizers
79
+    function tokenBase(stream, state) {
80
+      if (stream.sol()) state.indent = stream.indentation()
81
+      // Handle scope changes
82
+      if (stream.sol() && top(state).type == "py") {
83
+        var scopeOffset = top(state).offset;
84
+        if (stream.eatSpace()) {
85
+          var lineOffset = stream.indentation();
86
+          if (lineOffset > scopeOffset)
87
+            pushPyScope(state);
88
+          else if (lineOffset < scopeOffset && dedent(stream, state) && stream.peek() != "#")
89
+            state.errorToken = true;
90
+          return null;
91
+        } else {
92
+          var style = tokenBaseInner(stream, state);
93
+          if (scopeOffset > 0 && dedent(stream, state))
94
+            style += " " + ERRORCLASS;
95
+          return style;
96
+        }
97
+      }
98
+      return tokenBaseInner(stream, state);
99
+    }
100
+
101
+    function tokenBaseInner(stream, state) {
102
+      if (stream.eatSpace()) return null;
103
+
104
+      var ch = stream.peek();
105
+
106
+      // Handle Comments
107
+      if (ch == "#") {
108
+        stream.skipToEnd();
109
+        return "comment";
110
+      }
111
+
112
+      // Handle Number Literals
113
+      if (stream.match(/^[0-9\.]/, false)) {
114
+        var floatLiteral = false;
115
+        // Floats
116
+        if (stream.match(/^[\d_]*\.\d+(e[\+\-]?\d+)?/i)) { floatLiteral = true; }
117
+        if (stream.match(/^[\d_]+\.\d*/)) { floatLiteral = true; }
118
+        if (stream.match(/^\.\d+/)) { floatLiteral = true; }
119
+        if (floatLiteral) {
120
+          // Float literals may be "imaginary"
121
+          stream.eat(/J/i);
122
+          return "number";
123
+        }
124
+        // Integers
125
+        var intLiteral = false;
126
+        // Hex
127
+        if (stream.match(/^0x[0-9a-f_]+/i)) intLiteral = true;
128
+        // Binary
129
+        if (stream.match(/^0b[01_]+/i)) intLiteral = true;
130
+        // Octal
131
+        if (stream.match(/^0o[0-7_]+/i)) intLiteral = true;
132
+        // Decimal
133
+        if (stream.match(/^[1-9][\d_]*(e[\+\-]?[\d_]+)?/)) {
134
+          // Decimal literals may be "imaginary"
135
+          stream.eat(/J/i);
136
+          // TODO - Can you have imaginary longs?
137
+          intLiteral = true;
138
+        }
139
+        // Zero by itself with no other piece of number.
140
+        if (stream.match(/^0(?![\dx])/i)) intLiteral = true;
141
+        if (intLiteral) {
142
+          // Integer literals may be "long"
143
+          stream.eat(/L/i);
144
+          return "number";
145
+        }
146
+      }
147
+
148
+      // Handle Strings
149
+      if (stream.match(stringPrefixes)) {
150
+        state.tokenize = tokenStringFactory(stream.current());
151
+        return state.tokenize(stream, state);
152
+      }
153
+
154
+      // Handle operators and Delimiters
155
+      if (stream.match(tripleDelimiters) || stream.match(doubleDelimiters))
156
+        return "punctuation";
157
+
158
+      if (stream.match(doubleOperators) || stream.match(singleOperators))
159
+        return "operator";
160
+
161
+      if (stream.match(singleDelimiters))
162
+        return "punctuation";
163
+
164
+      if (state.lastToken == "." && stream.match(identifiers))
165
+        return "property";
166
+
167
+      if (stream.match(keywords) || stream.match(wordOperators))
168
+        return "keyword";
169
+
170
+      if (stream.match(builtins))
171
+        return "builtin";
172
+
173
+      if (stream.match(/^(self|cls)\b/))
174
+        return "variable-2";
175
+
176
+      if (stream.match(identifiers)) {
177
+        if (state.lastToken == "def" || state.lastToken == "class")
178
+          return "def";
179
+        return "variable";
180
+      }
181
+
182
+      // Handle non-detected items
183
+      stream.next();
184
+      return ERRORCLASS;
185
+    }
186
+
187
+    function tokenStringFactory(delimiter) {
188
+      while ("rubf".indexOf(delimiter.charAt(0).toLowerCase()) >= 0)
189
+        delimiter = delimiter.substr(1);
190
+
191
+      var singleline = delimiter.length == 1;
192
+      var OUTCLASS = "string";
193
+
194
+      function tokenString(stream, state) {
195
+        while (!stream.eol()) {
196
+          stream.eatWhile(/[^'"\\]/);
197
+          if (stream.eat("\\")) {
198
+            stream.next();
199
+            if (singleline && stream.eol())
200
+              return OUTCLASS;
201
+          } else if (stream.match(delimiter)) {
202
+            state.tokenize = tokenBase;
203
+            return OUTCLASS;
204
+          } else {
205
+            stream.eat(/['"]/);
206
+          }
207
+        }
208
+        if (singleline) {
209
+          if (parserConf.singleLineStringErrors)
210
+            return ERRORCLASS;
211
+          else
212
+            state.tokenize = tokenBase;
213
+        }
214
+        return OUTCLASS;
215
+      }
216
+      tokenString.isString = true;
217
+      return tokenString;
218
+    }
219
+
220
+    function pushPyScope(state) {
221
+      while (top(state).type != "py") state.scopes.pop()
222
+      state.scopes.push({offset: top(state).offset + conf.indentUnit,
223
+                         type: "py",
224
+                         align: null})
225
+    }
226
+
227
+    function pushBracketScope(stream, state, type) {
228
+      var align = stream.match(/^([\s\[\{\(]|#.*)*$/, false) ? null : stream.column() + 1
229
+      state.scopes.push({offset: state.indent + hangingIndent,
230
+                         type: type,
231
+                         align: align})
232
+    }
233
+
234
+    function dedent(stream, state) {
235
+      var indented = stream.indentation();
236
+      while (state.scopes.length > 1 && top(state).offset > indented) {
237
+        if (top(state).type != "py") return true;
238
+        state.scopes.pop();
239
+      }
240
+      return top(state).offset != indented;
241
+    }
242
+
243
+    function tokenLexer(stream, state) {
244
+      if (stream.sol()) state.beginningOfLine = true;
245
+
246
+      var style = state.tokenize(stream, state);
247
+      var current = stream.current();
248
+
249
+      // Handle decorators
250
+      if (state.beginningOfLine && current == "@")
251
+        return stream.match(identifiers, false) ? "meta" : py3 ? "operator" : ERRORCLASS;
252
+
253
+      if (/\S/.test(current)) state.beginningOfLine = false;
254
+
255
+      if ((style == "variable" || style == "builtin")
256
+          && state.lastToken == "meta")
257
+        style = "meta";
258
+
259
+      // Handle scope changes.
260
+      if (current == "pass" || current == "return")
261
+        state.dedent += 1;
262
+
263
+      if (current == "lambda") state.lambda = true;
264
+      if (current == ":" && !state.lambda && top(state).type == "py")
265
+        pushPyScope(state);
266
+
267
+      var delimiter_index = current.length == 1 ? "[({".indexOf(current) : -1;
268
+      if (delimiter_index != -1)
269
+        pushBracketScope(stream, state, "])}".slice(delimiter_index, delimiter_index+1));
270
+
271
+      delimiter_index = "])}".indexOf(current);
272
+      if (delimiter_index != -1) {
273
+        if (top(state).type == current) state.indent = state.scopes.pop().offset - hangingIndent
274
+        else return ERRORCLASS;
275
+      }
276
+      if (state.dedent > 0 && stream.eol() && top(state).type == "py") {
277
+        if (state.scopes.length > 1) state.scopes.pop();
278
+        state.dedent -= 1;
279
+      }
280
+
281
+      return style;
282
+    }
283
+
284
+    var external = {
285
+      startState: function(basecolumn) {
286
+        return {
287
+          tokenize: tokenBase,
288
+          scopes: [{offset: basecolumn || 0, type: "py", align: null}],
289
+          indent: basecolumn || 0,
290
+          lastToken: null,
291
+          lambda: false,
292
+          dedent: 0
293
+        };
294
+      },
295
+
296
+      token: function(stream, state) {
297
+        var addErr = state.errorToken;
298
+        if (addErr) state.errorToken = false;
299
+        var style = tokenLexer(stream, state);
300
+
301
+        if (style && style != "comment")
302
+          state.lastToken = (style == "keyword" || style == "punctuation") ? stream.current() : style;
303
+        if (style == "punctuation") style = null;
304
+
305
+        if (stream.eol() && state.lambda)
306
+          state.lambda = false;
307
+        return addErr ? style + " " + ERRORCLASS : style;
308
+      },
309
+
310
+      indent: function(state, textAfter) {
311
+        if (state.tokenize != tokenBase)
312
+          return state.tokenize.isString ? CodeMirror.Pass : 0;
313
+
314
+        var scope = top(state), closing = scope.type == textAfter.charAt(0)
315
+        if (scope.align != null)
316
+          return scope.align - (closing ? 1 : 0)
317
+        else
318
+          return scope.offset - (closing ? hangingIndent : 0)
319
+      },
320
+
321
+      electricInput: /^\s*[\}\]\)]$/,
322
+      closeBrackets: {triples: "'\""},
323
+      lineComment: "#",
324
+      fold: "indent"
325
+    };
326
+    return external;
327
+  });
328
+
329
+  CodeMirror.defineMIME("text/x-python", "python");
330
+
331
+  var words = function(str) { return str.split(" "); };
332
+
333
+  CodeMirror.defineMIME("text/x-cython", {
334
+    name: "python",
335
+    extra_keywords: words("by cdef cimport cpdef ctypedef enum except"+
336
+                          "extern gil include nogil property public"+
337
+                          "readonly struct union DEF IF ELIF ELSE")
338
+  });
339
+
340
+});

+ 139 - 0
xxl-job-admin/src/main/webapp/static/plugins/codemirror/mode/shell/shell.js Vedi File

@@ -0,0 +1,139 @@
1
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
2
+// Distributed under an MIT license: http://codemirror.net/LICENSE
3
+
4
+(function(mod) {
5
+  if (typeof exports == "object" && typeof module == "object") // CommonJS
6
+    mod(require("../../lib/codemirror"));
7
+  else if (typeof define == "function" && define.amd) // AMD
8
+    define(["../../lib/codemirror"], mod);
9
+  else // Plain browser env
10
+    mod(CodeMirror);
11
+})(function(CodeMirror) {
12
+"use strict";
13
+
14
+CodeMirror.defineMode('shell', function() {
15
+
16
+  var words = {};
17
+  function define(style, string) {
18
+    var split = string.split(' ');
19
+    for(var i = 0; i < split.length; i++) {
20
+      words[split[i]] = style;
21
+    }
22
+  };
23
+
24
+  // Atoms
25
+  define('atom', 'true false');
26
+
27
+  // Keywords
28
+  define('keyword', 'if then do else elif while until for in esac fi fin ' +
29
+    'fil done exit set unset export function');
30
+
31
+  // Commands
32
+  define('builtin', 'ab awk bash beep cat cc cd chown chmod chroot clear cp ' +
33
+    'curl cut diff echo find gawk gcc get git grep kill killall ln ls make ' +
34
+    'mkdir openssl mv nc node npm ping ps restart rm rmdir sed service sh ' +
35
+    'shopt shred source sort sleep ssh start stop su sudo tee telnet top ' +
36
+    'touch vi vim wall wc wget who write yes zsh');
37
+
38
+  function tokenBase(stream, state) {
39
+    if (stream.eatSpace()) return null;
40
+
41
+    var sol = stream.sol();
42
+    var ch = stream.next();
43
+
44
+    if (ch === '\\') {
45
+      stream.next();
46
+      return null;
47
+    }
48
+    if (ch === '\'' || ch === '"' || ch === '`') {
49
+      state.tokens.unshift(tokenString(ch, ch === "`" ? "quote" : "string"));
50
+      return tokenize(stream, state);
51
+    }
52
+    if (ch === '#') {
53
+      if (sol && stream.eat('!')) {
54
+        stream.skipToEnd();
55
+        return 'meta'; // 'comment'?
56
+      }
57
+      stream.skipToEnd();
58
+      return 'comment';
59
+    }
60
+    if (ch === '$') {
61
+      state.tokens.unshift(tokenDollar);
62
+      return tokenize(stream, state);
63
+    }
64
+    if (ch === '+' || ch === '=') {
65
+      return 'operator';
66
+    }
67
+    if (ch === '-') {
68
+      stream.eat('-');
69
+      stream.eatWhile(/\w/);
70
+      return 'attribute';
71
+    }
72
+    if (/\d/.test(ch)) {
73
+      stream.eatWhile(/\d/);
74
+      if(stream.eol() || !/\w/.test(stream.peek())) {
75
+        return 'number';
76
+      }
77
+    }
78
+    stream.eatWhile(/[\w-]/);
79
+    var cur = stream.current();
80
+    if (stream.peek() === '=' && /\w+/.test(cur)) return 'def';
81
+    return words.hasOwnProperty(cur) ? words[cur] : null;
82
+  }
83
+
84
+  function tokenString(quote, style) {
85
+    var close = quote == "(" ? ")" : quote == "{" ? "}" : quote
86
+    return function(stream, state) {
87
+      var next, end = false, escaped = false;
88
+      while ((next = stream.next()) != null) {
89
+        if (next === close && !escaped) {
90
+          end = true;
91
+          break;
92
+        }
93
+        if (next === '$' && !escaped && quote !== "'") {
94
+          escaped = true;
95
+          stream.backUp(1);
96
+          state.tokens.unshift(tokenDollar);
97
+          break;
98
+        }
99
+        if (!escaped && next === quote && quote !== close) {
100
+          state.tokens.unshift(tokenString(quote, style))
101
+          return tokenize(stream, state)
102
+        }
103
+        escaped = !escaped && next === '\\';
104
+      }
105
+      if (end || !escaped) state.tokens.shift();
106
+      return style;
107
+    };
108
+  };
109
+
110
+  var tokenDollar = function(stream, state) {
111
+    if (state.tokens.length > 1) stream.eat('$');
112
+    var ch = stream.next()
113
+    if (/['"({]/.test(ch)) {
114
+      state.tokens[0] = tokenString(ch, ch == "(" ? "quote" : ch == "{" ? "def" : "string");
115
+      return tokenize(stream, state);
116
+    }
117
+    if (!/\d/.test(ch)) stream.eatWhile(/\w/);
118
+    state.tokens.shift();
119
+    return 'def';
120
+  };
121
+
122
+  function tokenize(stream, state) {
123
+    return (state.tokens[0] || tokenBase) (stream, state);
124
+  };
125
+
126
+  return {
127
+    startState: function() {return {tokens:[]};},
128
+    token: function(stream, state) {
129
+      return tokenize(stream, state);
130
+    },
131
+    closeBrackets: "()[]{}''\"\"``",
132
+    lineComment: '#',
133
+    fold: "brace"
134
+  };
135
+});
136
+
137
+CodeMirror.defineMIME('text/x-sh', 'shell');
138
+
139
+});

+ 3 - 0
xxl-job-core/src/main/java/com/xxl/job/core/thread/JobThread.java Vedi File

@@ -87,6 +87,9 @@ public class JobThread extends Thread{
87 87
 							executeResult = ReturnT.FAIL;
88 88
 						}
89 89
 					} catch (Exception e) {
90
+						if (toStop) {
91
+							logger.error("----------- xxl-job toStop, stopReason:{}", stopReason);
92
+						}
90 93
 						logger.error("JobThread Exception:", e);
91 94
 						StringWriter out = new StringWriter();
92 95
 						e.printStackTrace(new PrintWriter(out));