diff --git a/xxl-job-core/src/main/java/com/xxl/job/core/thread/ExecutorRegistryThread.java b/xxl-job-core/src/main/java/com/xxl/job/core/thread/ExecutorRegistryThread.java index 5e618606..962504cc 100644 --- a/xxl-job-core/src/main/java/com/xxl/job/core/thread/ExecutorRegistryThread.java +++ b/xxl-job-core/src/main/java/com/xxl/job/core/thread/ExecutorRegistryThread.java @@ -49,25 +49,31 @@ public class ExecutorRegistryThread extends Thread { @Override public void run() { while (!toStop) { + try { RegistryParam registryParam = new RegistryParam(RegistryConfig.RegistType.EXECUTOR.name(), appName, executorAddress); - ReturnT registryResult = null; for (String addressUrl: XxlJobExecutor.adminAddresses.split(",")) { String apiUrl = addressUrl.concat("/api"); - AdminBiz adminBiz = (AdminBiz) new NetComClientProxy(AdminBiz.class, apiUrl).getObject(); - registryResult = adminBiz.registry(registryParam); - if (registryResult!=null && ReturnT.SUCCESS_CODE == registryResult.getCode()) { - registryResult = ReturnT.SUCCESS; - break; + try { + AdminBiz adminBiz = (AdminBiz) new NetComClientProxy(AdminBiz.class, apiUrl).getObject(); + ReturnT registryResult = adminBiz.registry(registryParam); + if (registryResult!=null && ReturnT.SUCCESS_CODE == registryResult.getCode()) { + registryResult = ReturnT.SUCCESS; + logger.info(">>>>>>>>>>> xxl-job registry success, registryParam:{}, registryResult:{}", new Object[]{registryParam, registryResult}); + break; + } else { + logger.info(">>>>>>>>>>> xxl-job registry fail, registryParam:{}, registryResult:{}", new Object[]{registryParam, registryResult}); + } + } catch (Exception e) { + logger.info(">>>>>>>>>>> xxl-job registry error, registryParam:{}", registryParam, e); } + } - logger.info(">>>>>>>>>>> xxl-job Executor registry {}, RegistryParam:{}, registryResult:{}", - new Object[]{(registryResult.getCode()==ReturnT.SUCCESS_CODE?"success":"fail"), registryParam.toString(), registryResult.toString()}); } catch (Exception e) { - logger.error(">>>>>>>>>>> xxl-job ExecutorRegistryThread Exception:", e); + logger.error(e.getMessage(), e); } try { diff --git a/xxl-job-core/src/main/java/com/xxl/job/core/thread/TriggerCallbackThread.java b/xxl-job-core/src/main/java/com/xxl/job/core/thread/TriggerCallbackThread.java index 2d732477..55ddcae6 100644 --- a/xxl-job-core/src/main/java/com/xxl/job/core/thread/TriggerCallbackThread.java +++ b/xxl-job-core/src/main/java/com/xxl/job/core/thread/TriggerCallbackThread.java @@ -37,40 +37,40 @@ public class TriggerCallbackThread { HandleCallbackParam callback = getInstance().callBackQueue.take(); if (callback != null) { - // valid - if (XxlJobExecutor.adminAddresses==null || XxlJobExecutor.adminAddresses.trim().length()==0) { - logger.warn(">>>>>>>>>>>> xxl-job callback fail, adminAddresses is null."); - continue; - } - // callback list param List callbackParamList = new ArrayList(); int drainToNum = getInstance().callBackQueue.drainTo(callbackParamList); callbackParamList.add(callback); - // callback, will retry if error - try { + // valid + if (XxlJobExecutor.adminAddresses==null || XxlJobExecutor.adminAddresses.trim().length()==0) { + logger.warn(">>>>>>>>>>>> xxl-job callback fail, adminAddresses is null, callbackParamList:{}", callbackParamList); + continue; + } - ReturnT callbackResult = null; - for (String addressUrl: XxlJobExecutor.adminAddresses.split(",")) { - String apiUrl = addressUrl.concat("/api"); + // callback, will retry if error + for (String addressUrl: XxlJobExecutor.adminAddresses.split(",")) { + String apiUrl = addressUrl.concat("/api"); + try { AdminBiz adminBiz = (AdminBiz) new NetComClientProxy(AdminBiz.class, apiUrl).getObject(); - callbackResult = adminBiz.callback(callbackParamList); + ReturnT callbackResult = adminBiz.callback(callbackParamList); if (callbackResult!=null && ReturnT.SUCCESS_CODE == callbackResult.getCode()) { callbackResult = ReturnT.SUCCESS; + logger.info(">>>>>>>>>>> xxl-job callback success, callbackParamList:{}, callbackResult:{}", new Object[]{callbackParamList, callbackResult}); break; + } else { + logger.info(">>>>>>>>>>> xxl-job callback fail, callbackParamList:{}, callbackResult:{}", new Object[]{callbackParamList, callbackResult}); } + } catch (Exception e) { + logger.error(">>>>>>>>>>> xxl-job callback error, callbackParamList:{}", callbackParamList, e); + //getInstance().callBackQueue.addAll(callbackParamList); } - - logger.info(">>>>>>>>>>> xxl-job callback, callbackParamList:{}, callbackResult:{}", new Object[]{callbackParamList, callbackResult}); - } catch (Exception e) { - logger.error(">>>>>>>>>>> xxl-job TriggerCallbackThread Exception:", e); - //getInstance().callBackQueue.addAll(callbackParamList); } + } } catch (Exception e) { - logger.error("", e); + logger.error(e.getMessage(), e); } } }