From ff8e43af54e19813afa855d521a30fc19a1047a6 Mon Sep 17 00:00:00 2001 From: xuxueli <931591021@qq.com> Date: Thu, 27 Jul 2017 23:10:33 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E5=BA=A6=E4=B8=AD=E5=BF=83API?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E6=94=B9=E4=B8=BA=E8=87=AA=E7=A0=94RPC?= =?UTF-8?q?=E5=BD=A2=E5=BC=8F=EF=BC=8C=E7=BB=9F=E4=B8=80=E5=BA=95=E5=B1=82?= =?UTF-8?q?=E9=80=9A=E8=AE=AF=E6=A8=A1=E5=9E=8B=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/xxl/job/admin/controller/JobApiController.java | 6 ------ .../xxl/job/admin/core/schedule/XxlJobDynamicScheduler.java | 6 +++--- .../main/java/com/xxl/job/core/executor/XxlJobExecutor.java | 2 +- .../xxl/job/core/rpc/netcom/jetty/client/JettyClient.java | 2 +- 4 files changed, 5 insertions(+), 11 deletions(-) diff --git a/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobApiController.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobApiController.java index 8a36c6cf..d86fa4c3 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobApiController.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobApiController.java @@ -1,8 +1,6 @@ package com.xxl.job.admin.controller; import com.xxl.job.admin.controller.annotation.PermessionLimit; -import com.xxl.job.admin.core.schedule.XxlJobDynamicScheduler; -import com.xxl.job.core.biz.AdminBiz; import com.xxl.job.core.rpc.codec.RpcRequest; import com.xxl.job.core.rpc.codec.RpcResponse; import com.xxl.job.core.rpc.netcom.NetComServerFactory; @@ -25,10 +23,6 @@ import java.io.OutputStream; public class JobApiController { private static Logger logger = LoggerFactory.getLogger(JobApiController.class); - static { - NetComServerFactory.putService(AdminBiz.class, XxlJobDynamicScheduler.adminBiz); - } - private RpcResponse doInvoke(HttpServletRequest request) { try { // deserialize request diff --git a/xxl-job-admin/src/main/java/com/xxl/job/admin/core/schedule/XxlJobDynamicScheduler.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/schedule/XxlJobDynamicScheduler.java index 3fc57fd0..cac05002 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/admin/core/schedule/XxlJobDynamicScheduler.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/schedule/XxlJobDynamicScheduler.java @@ -38,13 +38,15 @@ public final class XxlJobDynamicScheduler implements ApplicationContextAware, In } // init - private NetComServerFactory serverFactory = new NetComServerFactory(); public void init() throws Exception { // admin registry monitor run JobRegistryMonitorHelper.getInstance().start(); // admin monitor run JobFailMonitorHelper.getInstance().start(); + + // rpc-service, base on spring-mvc + NetComServerFactory.putService(AdminBiz.class, XxlJobDynamicScheduler.adminBiz); } // destroy @@ -54,8 +56,6 @@ public final class XxlJobDynamicScheduler implements ApplicationContextAware, In // admin monitor stop JobFailMonitorHelper.getInstance().toStop(); - - serverFactory.destroy(); } // xxlJobLogDao、xxlJobInfoDao diff --git a/xxl-job-core/src/main/java/com/xxl/job/core/executor/XxlJobExecutor.java b/xxl-job-core/src/main/java/com/xxl/job/core/executor/XxlJobExecutor.java index e7a1de37..89c63de2 100644 --- a/xxl-job-core/src/main/java/com/xxl/job/core/executor/XxlJobExecutor.java +++ b/xxl-job-core/src/main/java/com/xxl/job/core/executor/XxlJobExecutor.java @@ -52,7 +52,7 @@ public class XxlJobExecutor implements ApplicationContextAware, ApplicationListe private NetComServerFactory serverFactory = new NetComServerFactory(); public void start() throws Exception { // executor start - NetComServerFactory.putService(ExecutorBiz.class, new ExecutorBizImpl()); + NetComServerFactory.putService(ExecutorBiz.class, new ExecutorBizImpl()); // rpc-service, base on jetty serverFactory.start(port, ip, appName); // trigger callback thread start diff --git a/xxl-job-core/src/main/java/com/xxl/job/core/rpc/netcom/jetty/client/JettyClient.java b/xxl-job-core/src/main/java/com/xxl/job/core/rpc/netcom/jetty/client/JettyClient.java index 27e25fb0..2402949a 100644 --- a/xxl-job-core/src/main/java/com/xxl/job/core/rpc/netcom/jetty/client/JettyClient.java +++ b/xxl-job-core/src/main/java/com/xxl/job/core/rpc/netcom/jetty/client/JettyClient.java @@ -21,7 +21,7 @@ public class JettyClient { // reqURL String reqURL = request.getServerAddress(); - if (reqURL!=null && reqURL.indexOf("http://")==-1) { + if (reqURL!=null && reqURL.toLowerCase().indexOf("http://")==-1) { reqURL = "http://" + request.getServerAddress() + "/"; }