调度中心API服务改为自研RPC形式,统一底层通讯模型;

v1.8.2
xuxueli 7 years ago
parent ee07e0b794
commit ff8e43af54

@ -1,8 +1,6 @@
package com.xxl.job.admin.controller; package com.xxl.job.admin.controller;
import com.xxl.job.admin.controller.annotation.PermessionLimit; 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.RpcRequest;
import com.xxl.job.core.rpc.codec.RpcResponse; import com.xxl.job.core.rpc.codec.RpcResponse;
import com.xxl.job.core.rpc.netcom.NetComServerFactory; import com.xxl.job.core.rpc.netcom.NetComServerFactory;
@ -25,10 +23,6 @@ import java.io.OutputStream;
public class JobApiController { public class JobApiController {
private static Logger logger = LoggerFactory.getLogger(JobApiController.class); private static Logger logger = LoggerFactory.getLogger(JobApiController.class);
static {
NetComServerFactory.putService(AdminBiz.class, XxlJobDynamicScheduler.adminBiz);
}
private RpcResponse doInvoke(HttpServletRequest request) { private RpcResponse doInvoke(HttpServletRequest request) {
try { try {
// deserialize request // deserialize request

@ -38,13 +38,15 @@ public final class XxlJobDynamicScheduler implements ApplicationContextAware, In
} }
// init // init
private NetComServerFactory serverFactory = new NetComServerFactory();
public void init() throws Exception { public void init() throws Exception {
// admin registry monitor run // admin registry monitor run
JobRegistryMonitorHelper.getInstance().start(); JobRegistryMonitorHelper.getInstance().start();
// admin monitor run // admin monitor run
JobFailMonitorHelper.getInstance().start(); JobFailMonitorHelper.getInstance().start();
// rpc-service, base on spring-mvc
NetComServerFactory.putService(AdminBiz.class, XxlJobDynamicScheduler.adminBiz);
} }
// destroy // destroy
@ -54,8 +56,6 @@ public final class XxlJobDynamicScheduler implements ApplicationContextAware, In
// admin monitor stop // admin monitor stop
JobFailMonitorHelper.getInstance().toStop(); JobFailMonitorHelper.getInstance().toStop();
serverFactory.destroy();
} }
// xxlJobLogDao、xxlJobInfoDao // xxlJobLogDao、xxlJobInfoDao

@ -52,7 +52,7 @@ public class XxlJobExecutor implements ApplicationContextAware, ApplicationListe
private NetComServerFactory serverFactory = new NetComServerFactory(); private NetComServerFactory serverFactory = new NetComServerFactory();
public void start() throws Exception { public void start() throws Exception {
// executor start // executor start
NetComServerFactory.putService(ExecutorBiz.class, new ExecutorBizImpl()); NetComServerFactory.putService(ExecutorBiz.class, new ExecutorBizImpl()); // rpc-service, base on jetty
serverFactory.start(port, ip, appName); serverFactory.start(port, ip, appName);
// trigger callback thread start // trigger callback thread start

@ -21,7 +21,7 @@ public class JettyClient {
// reqURL // reqURL
String reqURL = request.getServerAddress(); String reqURL = request.getServerAddress();
if (reqURL!=null && reqURL.indexOf("http://")==-1) { if (reqURL!=null && reqURL.toLowerCase().indexOf("http://")==-1) {
reqURL = "http://" + request.getServerAddress() + "/"; reqURL = "http://" + request.getServerAddress() + "/";
} }

Loading…
Cancel
Save