{"id":1801,"date":"2024-05-25T23:18:42","date_gmt":"2024-05-25T15:18:42","guid":{"rendered":"https:\/\/diuut.com\/?p=1801"},"modified":"2024-05-26T22:43:13","modified_gmt":"2024-05-26T14:43:13","slug":"xxl-job%e6%95%b4%e5%90%88%e6%94%b9%e9%80%a0%e8%ae%b0%e5%bd%95%ef%bc%88%e8%bf%9c%e7%a8%8b%e8%b0%83%e7%94%a8%ef%bc%8c%e5%ad%90%e4%bb%bb%e5%8a%a1%e6%8e%a7%e5%88%b6%ef%bc%8c%e6%97%a5%e5%bf%97%e5%a2%9e","status":"publish","type":"post","link":"https:\/\/diuut.com\/?p=1801","title":{"rendered":"xxl-job\u6574\u5408\u6539\u9020\u8bb0\u5f55\uff08\u8fdc\u7a0b\u8c03\u7528\uff0c\u5b50\u4efb\u52a1\u63a7\u5236\uff0c\u65e5\u5fd7\u589e\u5f3a\uff09"},"content":{"rendered":"\n<blockquote class=\"wp-block-quote\"><p>\u9700\u6c42<\/p><cite>\u5ba2\u6237\u60f3\u5728\u7cfb\u7edfA\u7684\u6846\u67b6\u4f53\u7cfb\u4e2d\uff0c\u76f4\u63a5\u8c03\u7528\u67e5\u770bxxlJob\u7684\u539f\u6709\u529f\u80fd\uff0c\u4ee5\u53ca\u65b0\u589e\u90e8\u5206\u529f\u80fd\u8c03\u7528\u4f18\u5316\uff0c\u672c\u7bc7\u6587\u7ae0\u5373\u8bb0\u5f55\u6b64\u6b21\u6539\u9020\u4e2d\u90e8\u5206\u601d\u8def\u4ee5\u53ca\u5177\u4f53\u5b9e\u73b0\u65b9\u6cd5\u3002<\/cite><\/blockquote>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_66_1 counter-hierarchy ez-toc-counter ez-toc-transparent ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\"><p class=\"ez-toc-title\">\u76ee\u5f55<\/p>\n<\/div><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/diuut.com\/?p=1801\/#%E8%BF%9C%E7%A8%8B%E8%B0%83%E7%94%A8\" title=\"\u8fdc\u7a0b\u8c03\u7528\">\u8fdc\u7a0b\u8c03\u7528<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/diuut.com\/?p=1801\/#%E5%AD%90%E4%BB%BB%E5%8A%A1%E6%8E%A7%E5%88%B6\" title=\"\u5b50\u4efb\u52a1\u63a7\u5236\">\u5b50\u4efb\u52a1\u63a7\u5236<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/diuut.com\/?p=1801\/#%E6%97%A5%E5%BF%97%E5%A2%9E%E5%BC%BA\" title=\"\u65e5\u5fd7\u589e\u5f3a\">\u65e5\u5fd7\u589e\u5f3a<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/diuut.com\/?p=1801\/#%E6%9C%AB\" title=\"\u672b\">\u672b<\/a><\/li><\/ul><\/nav><\/div>\n<h2><span class=\"ez-toc-section\" id=\"%E8%BF%9C%E7%A8%8B%E8%B0%83%E7%94%A8\"><\/span>\u8fdc\u7a0b\u8c03\u7528<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>\u60f3\u5728\u539f\u7cfb\u7edf\u4e2d\u8fdc\u7a0b\u8c03\u7528\u8fdc\u7a0b\u65b9\u6cd5\uff0c\u5e38\u7528\u6709http RestFul API\u63a5\u53e3\u7684\u65b9\u5f0f(openfeign\u548cribbon)\u3001RPC(dubbo)\u3001\u6d88\u606f\u961f\u5217(rocketmq\uff0crabbitmq)<\/p>\n\n\n\n<p>\u56e0\u4e3a\u8fd9\u8fb9\u539f\u7cfb\u7edf\u5c31\u662fspringboot\uff0c\u6545\u4f7f\u7528Feign\u7684\u65b9\u5f0f\u8f83\u4e3a\u65b9\u4fbf\u3002<\/p>\n\n\n\n<p>\u5f15\u5165\u5305<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: xml; title: ; notranslate\" title=\"\">\n&lt;dependency&gt;\n            &lt;groupId&gt;org.springframework.cloud&lt;\/groupId&gt;\n            &lt;artifactId&gt;spring-cloud-starter-openfeign&lt;\/artifactId&gt;\n            &lt;version&gt;3.1.2&lt;\/version&gt;\n&lt;\/dependency&gt;\n<\/pre><\/div>\n\n\n<p>\u539fxxljob\u4e2d\u7684\u63a5\u53e3\u662f\u6807\u51c6\u7684RestFul\u63a5\u53e3\uff0c\u6240\u4ee5\u8fdc\u7a0b\u8c03\u7528\u7684\u65f6\u5019\u53ea\u9700\u8981\u5c06\u63a5\u53e3\u53c2\u6570\u5c01\u88c5\u6210interface\u63a5\u53e3api\u5373\u53ef\u8c03\u7528\u3002<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: java; title: ; notranslate\" title=\"\">\n@FeignClient(name = &quot;jobInfo&quot;,\n        url = &quot;${userConfig.uri}&quot;,\n        path = &quot;\/jobinfo&quot;)\npublic interface JobInfoApi {\n    @RequestMapping(value = &quot;\/add&quot;, method = RequestMethod.POST,consumes = {&quot;application\/x-www-form-urlencoded&quot;})\n    ReturnT&lt;String&gt; add(@RequestHeader(&quot;ServerInfo&quot;) String token, @RequestBody XxlJobInfo jobInfo);\n\n    @RequestMapping(value = &quot;\/update&quot;, method = RequestMethod.POST,consumes = {&quot;application\/x-www-form-urlencoded&quot;})\n    ReturnT&lt;String&gt; update(@RequestHeader(&quot;ServerInfo&quot;) String token, @RequestBody XxlJobInfo jobInfo);\n\n    @RequestMapping(value = &quot;\/remove&quot;, method = RequestMethod.POST)\n    ReturnT&lt;String&gt; remove(@RequestHeader(&quot;ServerInfo&quot;) String token, @RequestParam(name = &quot;id&quot;) Integer id);\n\n    @RequestMapping(value = &quot;\/stop&quot;, method = RequestMethod.POST)\n    ReturnT&lt;String&gt; pause(@RequestHeader(&quot;ServerInfo&quot;) String token, @RequestParam(name = &quot;id&quot;) Integer id);\n\n    @RequestMapping(value = &quot;\/start&quot;, method = RequestMethod.POST)\n    ReturnT&lt;String&gt; start(@RequestHeader(&quot;ServerInfo&quot;) String token, @RequestParam(name = &quot;id&quot;) Integer id);\n\n    @RequestMapping(value = &quot;\/trigger&quot;, method = RequestMethod.POST)\n    ReturnT&lt;String&gt; triggerJob(@RequestHeader(&quot;ServerInfo&quot;) String token, @RequestParam(name = &quot;id&quot;) Integer id, @RequestParam(name = &quot;executorParam&quot;) String executorParam,\n                               @RequestParam(name = &quot;addressList&quot;) String addressList,@RequestParam(name = &quot;ignoreSubTask&quot;) String ignoreSubTask,\n                               @RequestParam(name = &quot;taskLogId&quot;) Integer taskLogId);\n\n    @RequestMapping(value = &quot;\/nextTriggerTime&quot;, method = RequestMethod.POST)\n    ReturnT&lt;List&lt;String&gt;&gt; nextTriggerTime(@RequestHeader(&quot;ServerInfo&quot;) String token, @RequestParam(name = &quot;scheduleType&quot;) String scheduleType, @RequestParam(name = &quot;scheduleConf&quot;) String scheduleConf);\n\n    @RequestMapping(value = &quot;\/getOneById&quot;, method = RequestMethod.POST)\n    ReturnT&lt;XxlJobInfo&gt; getOneById(@RequestHeader(&quot;ServerInfo&quot;) String token, @RequestParam(name = &quot;id&quot;) Integer id);\n}\n<\/pre><\/div>\n\n\n<p>\u7531\u4e8e\u662f\u5185\u7f51\u8c03\u7528\uff0c\u6240\u4ee5\u8fdc\u7a0b\u8c03\u7528\u539f\u672c\u9700\u8981\u7279\u522b\u6ce8\u610f\u7684\u4e00\u4e9b\u52a0\u5bc6\u6216\u8005\u8ba4\u8bc1\u6b64\u5904\u4e5f\u53ef\u4ee5\u7565\u5fae\u7b80\u5316\uff0c\u6211\u8fd9\u8fb9\u662f\u901a\u8fc7\u5728\u6240\u6709\u5199\u7684\u8c03\u7528\u63a5\u53e3\u4e2d\u989d\u5916\u9644\u5e26\u4e86\u4e00\u4e2a\u53c2\u6570Header\uff0c\u7136\u540e\u518d\u5728xxl-job-admin\u8c03\u5ea6\u5e73\u53f0\u4e2d\u7684PermissionInterceptor\u62e6\u622a\u5668\u4e2d\u4fee\u6539\uff0c\u5982\u679cHeader\u4e00\u81f4\uff0c\u5c31\u76f4\u63a5\u5141\u8bb8\u8c03\u7528\u3002<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: java; title: ; notranslate\" title=\"\">\n@Value(value = &quot;${userConfig.auth-token:PORTAL}&quot;)\n    private String authToken;\n<\/pre><\/div>\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: java; title: ; notranslate\" title=\"\">\npublic class PermissionInterceptor extends HandlerInterceptorAdapter {\n\n    @Resource\n    private LoginService loginService;\n\n    @Override\n    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {\n\n        if (!(handler instanceof HandlerMethod)) {\n            return super.preHandle(request, response, handler);\n        }\n\n        \/\/ if need login\n        boolean needLogin = true;\n        boolean needAdminuser = false;\n        HandlerMethod method = (HandlerMethod) handler;\n        PermissionLimit permission = method.getMethodAnnotation(PermissionLimit.class);\n        if (permission != null) {\n            needLogin = permission.limit();\n            needAdminuser = permission.adminuser();\n        }\n        \/\/\u6765\u81eaportal\u7684\u8bf7\u6c42\u4e34\u65f6\u8df3\u8fc7\u767b\u5f55\u6821\u9a8c\n        String serverInfo = request.getHeader(&quot;ServerInfo&quot;);\n        if (needLogin &amp;&amp; !&quot;PORTAL&quot;.equals(serverInfo)) {\n            XxlJobUser loginUser = loginService.ifLogin(request, response);\n            if (loginUser == null) {\n                response.setStatus(302);\n                response.setHeader(&quot;location&quot;, request.getContextPath() + &quot;\/toLogin&quot;);\n                return false;\n            }\n            if (needAdminuser &amp;&amp; loginUser.getRole() != 1) {\n                throw new RuntimeException(I18nUtil.getString(&quot;system_permission_limit&quot;));\n            }\n            request.setAttribute(LoginService.LOGIN_IDENTITY_KEY, loginUser);\n        }\n        return super.preHandle(request, response, handler);\n    }\n}\n<\/pre><\/div>\n\n\n<h2><span class=\"ez-toc-section\" id=\"%E5%AD%90%E4%BB%BB%E5%8A%A1%E6%8E%A7%E5%88%B6\"><\/span>\u5b50\u4efb\u52a1\u63a7\u5236<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>\u9700\u6c42\u4e2d\u9664\u4e86\u8fdc\u7a0b\u8c03\u7528\u63a5\u53e3\u6574\u5408\u4ee5\u540e\uff0c\u8fd8\u9700\u8981\u989d\u5916\u589e\u52a0\u529f\u80fd\u63a7\u5236\uff0c\u6216\u8005\u989d\u5916\u8865\u5145\u76f8\u5173\u65e5\u5fd7\u7b49\u5185\u5bb9\u3002<\/p>\n\n\n\n<p>\u5176\u4e2d\u4e00\u4e2a\u9700\u6c42\u573a\u666f\uff1a\u539f\u7cfb\u7edf\u4e2d\u4e00\u65e6\u914d\u7f6e\u4e86\u5b50\u4efb\u52a1\uff0c\u6bcf\u6b21\u6267\u884c\u4efb\u52a1\u65f6\u9ed8\u8ba4\u90fd\u4f1a\u5c06\u5b50\u4efb\u52a1\u4e00\u5e76\u542f\u52a8\uff0c\u5ba2\u6237\u60f3\u8981\u5728\u4e0d\u4fee\u6539\u914d\u7f6e\u7684\u524d\u63d0\u4e0b\u6bcf\u6b21\u63a7\u5236\u662f\u5426\u542f\u52a8\u3002<\/p>\n\n\n\n<p>\u6b64\u5904\u6211\u7684\u5b9e\u73b0\u65b9\u5f0f\u5c31\u662f\u524d\u7aef\u4f20\u53c2\u4e2d\u989d\u5916\u9644\u5e26\u4e00\u4e2a\u53c2\u6570[ignoreSubTask],\u9ed8\u8ba4\u4e0d\u4f20\uff0c\u5982\u679c\u5e26\u4e0a\u540e\u4e3a1\u7684\u8bdd\u5c31\u4e0d\u6267\u884c\u540e\u7eed\u5b50\u4efb\u52a1\uff0cXxlJob\u4e2d\u4efb\u52a1\u6267\u884c\u7684\u6267\u884c\u94fe\u5982\u4e0b<\/p>\n\n\n\n<ol><li>JobInfoController -&gt;<\/li><li>JobTriggerPoolHelper.trigger(*,*,*,*,*,ignoreSubTask) -&gt;<\/li><li>JobTriggerPoolHelper.addTrigger(<em>*,*,*,*,*,<\/em>ignoreSubTask) -&gt;<\/li><li>XxlJobTrigger.trigger(<em>*,*,*,*,*,<\/em>ignoreSubTask) -&gt;<\/li><li>XxlJobTrigger.processTrigger(<em>*,*,*,*,*,<\/em>ignoreSubTask)<\/li><\/ol>\n\n\n\n<p>\u6267\u884c\u5230\u7b2c\u4e94\u6b65\u5176\u5b9e\u5355\u6b21\u7684\u6267\u884c\u94fe\u5c31\u7ed3\u675f\u4e86\uff0c\u6211\u524d\u9762\u7684\u6d41\u7a0b\u76ee\u6807\u5176\u5b9e\u5c31\u662f\u4e3a\u4e86\u5c06\u8fd9\u4e2aignoreSubTask\u53c2\u6570\uff0c\u5b58\u5165xxljob\u4e2d\u6267\u884c\u524d\u4fdd\u5b58\u7684\u7684\u521d\u59cb\u5316XxlJobLog\u4e2d\uff0c\u8fd9\u4e2a\u65e5\u5fd7\u4f1a\u8bb0\u5f55\u76f8\u5173\u6267\u884c\u72b6\u6001\uff0c\u4ee5\u53ca\u7528\u4e8e\u6267\u884c\u5668\u8c03\u7528\u540e\u56de\u8c03\u51fd\u6570\u7684\u72b6\u6001\u66f4\u65b0\uff0c\u800c\u5176\u4e2d\u5b9e\u73b0\u5b50\u4efb\u52a1\u6267\u884c\u7684\u6267\u884c\u94fe\u5728\u6267\u884c\u5668executor\u6267\u884c\u5b8c\u5bf9\u5e94\u4efb\u52a1\u540e\u5c31\u4f1a\u53d1\u9001\u4e00\u4e2a\u56de\u8c03\u8bf7\u6c42\u89e6\u53d1\u8c03\u5ea6\u5e73\u53f0\u7684\u540e\u7eed\u52a8\u4f5c\u3002<\/p>\n\n\n\n<ol><li>JobApiController.api() -&gt; adminBiz.callback(callbackParamList) -&gt;<\/li><li>AdminBizImpl.callback() -&gt; <\/li><li>JobCompleteHelper.getInstance().callback(callbackParamList); -&gt;<\/li><li>XxlJobCompleter.updateHandleInfoAndFinish(log); -&gt;<\/li><li>XxlJobCompleter-&gt;finishJob(xxlJobLog);<\/li><\/ol>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: java; title: ; notranslate\" title=\"\">\n private static void finishJob(XxlJobLog xxlJobLog) {\n\n        \/\/ 1\u3001handle success, to trigger child job\n        String triggerChildMsg = null;\n        if (XxlJobContext.HANDLE_COCE_SUCCESS == xxlJobLog.getHandleCode()) {\n            XxlJobInfo xxlJobInfo = XxlJobAdminConfig.getAdminConfig().getXxlJobInfoDao().loadById(xxlJobLog.getJobId());\n            String ignoreSubTask = xxlJobLog.getIgnoreSubTask();\n            if (xxlJobInfo != null &amp;&amp; xxlJobInfo.getChildJobId() != null &amp;&amp; xxlJobInfo.getChildJobId().trim().length() &gt; 0 &amp;&amp;\n                    !TriggerTypeEnum.IGNORE_FLAG.getTitle().equals(ignoreSubTask)) {\n                    ......\n                    ......\n                    ......\n}\n<\/pre><\/div>\n\n\n<p>\u9700\u6c42\u4e2d\u63a7\u5236\u5b50\u4efb\u52a1\u7684\u76f8\u5173\u903b\u8f91\u5c31\u662f\u5728\u4e0a\u9762\u7684if\u5224\u65ad\u4e2d\u8fdb\u884c\uff0c\u662f\u5426\u6267\u884c\u5b50\u4efb\u52a1\u3002\u4e3a\u5565\u8981\u628a\u8fd9\u4e2a\u53c2\u6570\u653e\u5230xxljoblog\u4e2d\uff1f\u5c31\u662f\u5077\u61d2\u5427\uff0c\u4e0d\u60f3\u5355\u72ec\u989d\u5916\u4e00\u4e2a\u6d41\u7a0b\u4f20\u53c2\uff0c\u5c3d\u91cf\u5c11\u7684\u6539\u52a8\u539f\u6765\u7684\u6d41\u7a0b\uff0c\u4ec5\u6b64\u800c\u5df2\u3002<\/p>\n\n\n\n<h2><span class=\"ez-toc-section\" id=\"%E6%97%A5%E5%BF%97%E5%A2%9E%E5%BC%BA\"><\/span>\u65e5\u5fd7\u589e\u5f3a<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>\u53e6\u5916\u4e00\u4e2a\u573a\u666f\uff0c\u56e0\u4e3a\u5ba2\u6237\u9700\u6c42\u989d\u5916\u9700\u8981\u5b58\u50a8\u8bb0\u5f55\u4e00\u5957\u65e5\u5fd7\uff0c\u7528\u6765\u66f4\u65b0\u4e13\u95e8\u603b\u89c8\u8868\u4ee5\u65b9\u4fbf\u67e5\u770b\uff0c\u6240\u4ee5\u6bcf\u6b21\u5728\u8c03\u7528\u524d\uff0c\u4ee5\u53ca\u8c03\u7528\u7684\u56de\u8c03\u4e2d\uff0c\u9664\u4e86xxljoblog\u81ea\u5e26\u7684\u65e5\u5fd7\u66f4\u65b0\u5916\uff0c\u989d\u5916\u8bb0\u5f55\u4e86\u4e00\u5957\u81ea\u5df1\u7684\u65e5\u5fd7\uff0c\u7528\u6765\u5b9e\u73b0\u7279\u5b9a\u7684\u9700\u6c42\uff0c\u53ef\u4ee5\u6dfb\u52a0\u65e5\u5fd7\u7684\u5730\u65b9\u5728\u4e0a\u9762\u7684\u6267\u884c\u94fe\u5217\u8868\u5df2\u7ecf\u5217\u51fa\u6765\u4e86\uff0c\u8fd9\u91cc\u4e0d\u91cd\u590d\u5217\u51fa\uff0c\u6b64\u5904\u8865\u5145\u4e00\u4e2a\u65e5\u5fd7\u66f4\u65b0\u573a\u666f\uff0c\u5373\u6267\u884c\u5668\u6ce8\u518c\u4e22\u5931\u7684\u65f6\u5019\u4e14\u4efb\u52a1\u72b6\u6001\u4e3a\u8fdb\u884c\u4e2d\uff0c\u8d85\u8fc7\u5341\u5206\u949f\uff0c\u8fd9\u91cc\u6211\u4eec\u5c31\u6cbf\u7528xxljob\u8fd9\u4e2a\u5224\u65ad\u903b\u8f91<\/p>\n\n\n\n<p>xxljob\u4f5c\u8005\u7684\u7684\u5b9e\u73b0\u65b9\u5f0f\u662f\u5728JobCompleteHelper\u4e2d\u5f00\u542f\u4e00\u4e2a\u7ebf\u7a0b\uff0c\u8f6e\u8be2\u68c0\u67e5\u662f\u5426\u6709\u4efb\u52a1\u6267\u884c\u65f6\u95f4\u8d85\u8fc7\u6307\u5b9a\u65f6\u95f4\uff0c\u5e76\u4e14\u5bf9\u5e94\u7684\u6267\u884c\u5668\u5fc3\u8df3\u4e22\u5931\uff0c\u5c31\u5c06\u8fd9\u4e9b\u4efb\u52a1\u6267\u884c\u7ed3\u679c\u7f6e\u4e3a\u5931\u8d25<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: java; title: ; notranslate\" title=\"\">\nmonitorThread = new Thread(new Runnable() {\n\n\t\t\t@Override\n\t\t\tpublic void run() {\n\n\t\t\t\t\/\/ wait for JobTriggerPoolHelper-init\n\t\t\t\ttry {\n\t\t\t\t\tTimeUnit.MILLISECONDS.sleep(50);\n\t\t\t\t} catch (InterruptedException e) {\n\t\t\t\t\tif (!toStop) {\n\t\t\t\t\t\tlogger.error(e.getMessage(), e);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\/\/ monitor\n\t\t\t\twhile (!toStop) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\t\/\/ \u4efb\u52a1\u7ed3\u679c\u4e22\u5931\u5904\u7406\uff1a\u8c03\u5ea6\u8bb0\u5f55\u505c\u7559\u5728 &quot;\u8fd0\u884c\u4e2d&quot; \u72b6\u6001\u8d85\u8fc710min\uff0c\u4e14\u5bf9\u5e94\u6267\u884c\u5668\u5fc3\u8df3\u6ce8\u518c\u5931\u8d25\u4e0d\u5728\u7ebf\uff0c\u5219\u5c06\u672c\u5730\u8c03\u5ea6\u4e3b\u52a8\u6807\u8bb0\u5931\u8d25\uff1b\n\t\t\t\t\t\tDate losedTime = DateUtil.addMinutes(new Date(), -10);\n\t\t\t\t\t\tList&lt;Long&gt; losedJobIds  = XxlJobAdminConfig.getAdminConfig().getXxlJobLogDao().findLostJobIds(losedTime);\n\t\t\t\t\t\tif (losedJobIds!=null &amp;&amp; losedJobIds.size()&gt;0) {\n\t\t\t\t\t\t\tfor (Long logId: losedJobIds) {\n\t\t\t\t\t\t\t\tXxlJobLog jobLog = new XxlJobLog();\n\t\t\t\t\t\t\t\tjobLog.setId(logId);\n\t\t\t\t\t\t\t\tjobLog.setHandleTime(new Date());\n\t\t\t\t\t\t\t\tjobLog.setHandleCode(ReturnT.FAIL_CODE);\n\t\t\t\t\t\t\t\tjobLog.setHandleMsg( I18nUtil.getString(&quot;joblog_lost_fail&quot;) );\n\t\t\t\t\t\t\t\tXxlJobCompleter.updateHandleInfoAndFinish(jobLog);\n                                ...............\n\t\t\t\t\t\t\t\t...............\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (Exception e) {\n\t\t\t\t\t\tif (!toStop) {\n\t\t\t\t\t\t\tlogger.error(&quot;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; xxl-job, job fail monitor thread error:{}&quot;, e);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n                    try {\n                        TimeUnit.SECONDS.sleep(60);\n                    } catch (Exception e) {\n                        if (!toStop) {\n                            logger.error(e.getMessage(), e);\n                        }\n                    }\n                }\n\t\t\t\tlogger.info(&quot;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; xxl-job, JobLosedMonitorHelper stop&quot;);\n\t\t\t}\n\t\t});\n<\/pre><\/div>\n\n\n<h2><span class=\"ez-toc-section\" id=\"%E6%9C%AB\"><\/span>\u672b<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>\u672c\u7bc7\u5176\u5b9e\u6ca1\u6709\u8bb2\u592a\u591axxljob\u7684\u5e95\u5c42\u6e90\u7801\uff0c\u5176\u5b9e\u53ea\u662f\u68b3\u7406\u8bb0\u5f55\u4e86\u4e0b\u81ea\u5df1\u8fd9\u6b21\u6539\u9020\u4e2d\uff0c\u5bf9\u4e8exxljob\u5b9e\u73b0\u529f\u80fd\u7684\u6539\u9020\u601d\u8def\uff0c\u80a4\u6d45\u4e14\u788e\u788e\u5ff5\uff0c\u5982\u679c\u80fd\u5e2e\u5230\u6709\u540c\u6837\u9700\u6c42\u7684\u4eba\u5c31\u66f4\u597d\u4e86\u3002\u5176\u4ed6\u5177\u4f53\u7684\u6bd4\u5982xxljob\u7684\u65f6\u95f4\u8f6e\u6216\u8005\u81ea\u52a8\u6ce8\u518c\u7b49\u76f8\u5173\u8bbe\u8ba1\uff0c\u53ef\u4ee5\u770b\u770b\u7f51\u4e0a\u5176\u4ed6\u535a\u4e3b\u7684\u6587\u7ae0\uff0c\u4e5f\u53ef\u4ee5\u76f4\u63a5\u53bb\u6e90\u7801\u91cc\u7814\u7a76\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u9700\u6c42 \u5ba2\u6237\u60f3\u5728\u7cfb\u7edfA\u7684\u6846\u67b6\u4f53\u7cfb\u4e2d\uff0c\u76f4\u63a5\u8c03\u7528\u67e5\u770bxxlJob\u7684\u539f\u6709\u529f\u80fd\uff0c\u4ee5\u53ca\u65b0\u589e\u90e8\u5206\u529f\u80fd\u8c03\u7528\u4f18\u5316\uff0c\u672c\u7bc7\u6587\u7ae0\u5373\u8bb0\u5f55<span class=\"more-button\"><a href=\"https:\/\/diuut.com\/?p=1801\" class=\"more-link\">view all . . .<span class=\"screen-reader-text\">xxl-job\u6574\u5408\u6539\u9020\u8bb0\u5f55\uff08\u8fdc\u7a0b\u8c03\u7528\uff0c\u5b50\u4efb\u52a1\u63a7\u5236\uff0c\u65e5\u5fd7\u589e\u5f3a\uff09<\/span><\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":1808,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[2],"tags":[37,67],"_links":{"self":[{"href":"https:\/\/diuut.com\/index.php?rest_route=\/wp\/v2\/posts\/1801"}],"collection":[{"href":"https:\/\/diuut.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/diuut.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/diuut.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/diuut.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1801"}],"version-history":[{"count":8,"href":"https:\/\/diuut.com\/index.php?rest_route=\/wp\/v2\/posts\/1801\/revisions"}],"predecessor-version":[{"id":1812,"href":"https:\/\/diuut.com\/index.php?rest_route=\/wp\/v2\/posts\/1801\/revisions\/1812"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/diuut.com\/index.php?rest_route=\/wp\/v2\/media\/1808"}],"wp:attachment":[{"href":"https:\/\/diuut.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1801"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/diuut.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1801"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/diuut.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1801"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}