Quellcode durchsuchen

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

xuxueli vor 8 Jahren
Ursprung
Commit
ff8e43af54

+ 0 - 6
xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobApiController.java Datei anzeigen

1
 package com.xxl.job.admin.controller;
1
 package com.xxl.job.admin.controller;
2
 
2
 
3
 import com.xxl.job.admin.controller.annotation.PermessionLimit;
3
 import com.xxl.job.admin.controller.annotation.PermessionLimit;
4
-import com.xxl.job.admin.core.schedule.XxlJobDynamicScheduler;
5
-import com.xxl.job.core.biz.AdminBiz;
6
 import com.xxl.job.core.rpc.codec.RpcRequest;
4
 import com.xxl.job.core.rpc.codec.RpcRequest;
7
 import com.xxl.job.core.rpc.codec.RpcResponse;
5
 import com.xxl.job.core.rpc.codec.RpcResponse;
8
 import com.xxl.job.core.rpc.netcom.NetComServerFactory;
6
 import com.xxl.job.core.rpc.netcom.NetComServerFactory;
25
 public class JobApiController {
23
 public class JobApiController {
26
     private static Logger logger = LoggerFactory.getLogger(JobApiController.class);
24
     private static Logger logger = LoggerFactory.getLogger(JobApiController.class);
27
 
25
 
28
-    static {
29
-        NetComServerFactory.putService(AdminBiz.class, XxlJobDynamicScheduler.adminBiz);
30
-    }
31
-
32
     private RpcResponse doInvoke(HttpServletRequest request) {
26
     private RpcResponse doInvoke(HttpServletRequest request) {
33
         try {
27
         try {
34
             // deserialize request
28
             // deserialize request

+ 3 - 3
xxl-job-admin/src/main/java/com/xxl/job/admin/core/schedule/XxlJobDynamicScheduler.java Datei anzeigen

38
 	}
38
 	}
39
     
39
     
40
     // init
40
     // init
41
-    private NetComServerFactory serverFactory = new NetComServerFactory();
42
     public void init() throws Exception {
41
     public void init() throws Exception {
43
 		// admin registry monitor run
42
 		// admin registry monitor run
44
         JobRegistryMonitorHelper.getInstance().start();
43
         JobRegistryMonitorHelper.getInstance().start();
45
 
44
 
46
         // admin monitor run
45
         // admin monitor run
47
         JobFailMonitorHelper.getInstance().start();
46
         JobFailMonitorHelper.getInstance().start();
47
+
48
+        // rpc-service, base on spring-mvc
49
+        NetComServerFactory.putService(AdminBiz.class, XxlJobDynamicScheduler.adminBiz);
48
     }
50
     }
49
     
51
     
50
     // destroy
52
     // destroy
54
 
56
 
55
         // admin monitor stop
57
         // admin monitor stop
56
         JobFailMonitorHelper.getInstance().toStop();
58
         JobFailMonitorHelper.getInstance().toStop();
57
-
58
-        serverFactory.destroy();
59
     }
59
     }
60
     
60
     
61
     // xxlJobLogDao、xxlJobInfoDao
61
     // xxlJobLogDao、xxlJobInfoDao

+ 1 - 1
xxl-job-core/src/main/java/com/xxl/job/core/executor/XxlJobExecutor.java Datei anzeigen

52
     private NetComServerFactory serverFactory = new NetComServerFactory();
52
     private NetComServerFactory serverFactory = new NetComServerFactory();
53
     public void start() throws Exception {
53
     public void start() throws Exception {
54
         // executor start
54
         // executor start
55
-        NetComServerFactory.putService(ExecutorBiz.class, new ExecutorBizImpl());
55
+        NetComServerFactory.putService(ExecutorBiz.class, new ExecutorBizImpl());   // rpc-service, base on jetty
56
         serverFactory.start(port, ip, appName);
56
         serverFactory.start(port, ip, appName);
57
 
57
 
58
         // trigger callback thread start
58
         // trigger callback thread start

+ 1 - 1
xxl-job-core/src/main/java/com/xxl/job/core/rpc/netcom/jetty/client/JettyClient.java Datei anzeigen

21
 
21
 
22
 			// reqURL
22
 			// reqURL
23
 			String reqURL = request.getServerAddress();
23
 			String reqURL = request.getServerAddress();
24
-			if (reqURL!=null && reqURL.indexOf("http://")==-1) {
24
+			if (reqURL!=null && reqURL.toLowerCase().indexOf("http://")==-1) {
25
 				reqURL = "http://" + request.getServerAddress() + "/";
25
 				reqURL = "http://" + request.getServerAddress() + "/";
26
 			}
26
 			}
27
 
27