Przeglądaj źródła

底层通讯方案优化:升级较新版本xxl-rpc,由"JETTY"方案调整为"NETTY_HTTP"方案,执行器内嵌netty-http-server提供服务,调度中心复用容器端口提供服务;

xuxueli 6 lat temu
rodzic
commit
85bf656935

+ 2 - 3
doc/XXL-JOB官方文档.md Wyświetl plik

1419
 - 5、精简项目,取消第三方依赖,如 commons-collections4 ;
1419
 - 5、精简项目,取消第三方依赖,如 commons-collections4 ;
1420
 - 6、底层Log调优,应用正常终止取消异常栈信息打印;
1420
 - 6、底层Log调优,应用正常终止取消异常栈信息打印;
1421
 - 7、交互优化,尽量避免新开页面窗口;仅WebIDE支持新开页,并提供窗口快速关闭按钮;
1421
 - 7、交互优化,尽量避免新开页面窗口;仅WebIDE支持新开页,并提供窗口快速关闭按钮;
1422
+- 8、[测试中]底层通讯方案优化:升级较新版本xxl-rpc,由"JETTY"方案调整为"NETTY_HTTP"方案,执行器内嵌netty-http-server提供服务,调度中心复用容器端口提供服务;
1422
 - [迭代中]注册中心优化,实时性注册发现:心跳注册间隔10s,refresh失败则首次注册并立即更新注册信息,心跳类似;30s过期销毁;
1423
 - [迭代中]注册中心优化,实时性注册发现:心跳注册间隔10s,refresh失败则首次注册并立即更新注册信息,心跳类似;30s过期销毁;
1423
 - [迭代中]脚本任务,支持数据参数,新版本仅支持单参数不支持需要兼容;
1424
 - [迭代中]脚本任务,支持数据参数,新版本仅支持单参数不支持需要兼容;
1424
 - [迭代中]提供执行器Docker镜像;
1425
 - [迭代中]提供执行器Docker镜像;
1457
 - 31、调度中心-执行器通讯模型统一,双向RPC切换为Netty;
1458
 - 31、调度中心-执行器通讯模型统一,双向RPC切换为Netty;
1458
 - 32、任务暂停、删除优化,避免quartz delete不完整导致任务脏数据;
1459
 - 32、任务暂停、删除优化,避免quartz delete不完整导致任务脏数据;
1459
 - 32、quartz misfire 配置优化,计划改为0;
1460
 - 32、quartz misfire 配置优化,计划改为0;
1460
-- 33、job通讯调优:
1461
-    - 调度tcp;
1462
-    - 回调http(netty),handler复用mvc(考虑是否双向tcp);
1461
+
1463
 
1462
 
1464
 
1463
 
1465
 ## 七、其他
1464
 ## 七、其他

+ 1 - 2
pom.xml Wyświetl plik

24
 		<maven.compiler.target>1.7</maven.compiler.target>
24
 		<maven.compiler.target>1.7</maven.compiler.target>
25
 		<maven.test.skip>true</maven.test.skip>
25
 		<maven.test.skip>true</maven.test.skip>
26
 
26
 
27
-		<xxl-rpc.version>1.3.1</xxl-rpc.version>
28
-		<jetty-server.version>9.2.26.v20180806</jetty-server.version>
27
+		<xxl-rpc.version>1.3.2-SNAPSHOT</xxl-rpc.version>
29
 
28
 
30
 		<spring-boot.version>1.5.18.RELEASE</spring-boot.version>
29
 		<spring-boot.version>1.5.18.RELEASE</spring-boot.version>
31
 		<mybatis-spring-boot-starter.version>1.3.2</mybatis-spring-boot-starter.version>
30
 		<mybatis-spring-boot-starter.version>1.3.2</mybatis-spring-boot-starter.version>

+ 0 - 28
xxl-job-admin/pom.xml Wyświetl plik

18
 				<type>pom</type>
18
 				<type>pom</type>
19
 				<scope>import</scope>
19
 				<scope>import</scope>
20
 			</dependency>
20
 			</dependency>
21
-
22
-			<!-- jetty -->
23
-			<dependency>
24
-				<groupId>org.eclipse.jetty</groupId>
25
-				<artifactId>jetty-server</artifactId>
26
-				<version>${jetty-server.version}</version>
27
-			</dependency>
28
-			<dependency>
29
-				<groupId>org.eclipse.jetty</groupId>
30
-				<artifactId>jetty-util</artifactId>
31
-				<version>${jetty-server.version}</version>
32
-			</dependency>
33
-			<dependency>
34
-				<groupId>org.eclipse.jetty</groupId>
35
-				<artifactId>jetty-http</artifactId>
36
-				<version>${jetty-server.version}</version>
37
-			</dependency>
38
-			<dependency>
39
-				<groupId>org.eclipse.jetty</groupId>
40
-				<artifactId>jetty-io</artifactId>
41
-				<version>${jetty-server.version}</version>
42
-			</dependency>
43
-			<dependency>
44
-				<groupId>org.eclipse.jetty</groupId>
45
-				<artifactId>jetty-client</artifactId>
46
-				<version>${jetty-server.version}</version>
47
-			</dependency>
48
-
49
 		</dependencies>
21
 		</dependencies>
50
 	</dependencyManagement>
22
 	</dependencyManagement>
51
 
23
 

+ 6 - 7
xxl-job-admin/src/main/java/com/xxl/job/admin/core/schedule/XxlJobDynamicScheduler.java Wyświetl plik

15
 import com.xxl.rpc.remoting.invoker.reference.XxlRpcReferenceBean;
15
 import com.xxl.rpc.remoting.invoker.reference.XxlRpcReferenceBean;
16
 import com.xxl.rpc.remoting.invoker.route.LoadBalance;
16
 import com.xxl.rpc.remoting.invoker.route.LoadBalance;
17
 import com.xxl.rpc.remoting.net.NetEnum;
17
 import com.xxl.rpc.remoting.net.NetEnum;
18
-import com.xxl.rpc.remoting.net.impl.jetty.server.JettyServerHandler;
18
+import com.xxl.rpc.remoting.net.impl.servlet.server.ServletServerHandler;
19
 import com.xxl.rpc.remoting.provider.XxlRpcProviderFactory;
19
 import com.xxl.rpc.remoting.provider.XxlRpcProviderFactory;
20
 import com.xxl.rpc.serialize.Serializer;
20
 import com.xxl.rpc.serialize.Serializer;
21
-import org.eclipse.jetty.server.Request;
22
 import org.quartz.*;
21
 import org.quartz.*;
23
 import org.quartz.Trigger.TriggerState;
22
 import org.quartz.Trigger.TriggerState;
24
 import org.quartz.impl.triggers.CronTriggerImpl;
23
 import org.quartz.impl.triggers.CronTriggerImpl;
95
 
94
 
96
 
95
 
97
     // ---------------------- admin rpc provider (no server version) ----------------------
96
     // ---------------------- admin rpc provider (no server version) ----------------------
98
-    private static JettyServerHandler jettyServerHandler;
97
+    private static ServletServerHandler servletServerHandler;
99
     private void initRpcProvider(){
98
     private void initRpcProvider(){
100
         // init
99
         // init
101
         XxlRpcProviderFactory xxlRpcProviderFactory = new XxlRpcProviderFactory();
100
         XxlRpcProviderFactory xxlRpcProviderFactory = new XxlRpcProviderFactory();
102
         xxlRpcProviderFactory.initConfig(
101
         xxlRpcProviderFactory.initConfig(
103
-                NetEnum.JETTY,
102
+                NetEnum.NETTY_HTTP,
104
                 Serializer.SerializeEnum.HESSIAN.getSerializer(),
103
                 Serializer.SerializeEnum.HESSIAN.getSerializer(),
105
                 null,
104
                 null,
106
                 0,
105
                 0,
112
         xxlRpcProviderFactory.addService(AdminBiz.class.getName(), null, XxlJobAdminConfig.getAdminConfig().getAdminBiz());
111
         xxlRpcProviderFactory.addService(AdminBiz.class.getName(), null, XxlJobAdminConfig.getAdminConfig().getAdminBiz());
113
 
112
 
114
         // jetty handler
113
         // jetty handler
115
-        jettyServerHandler = new JettyServerHandler(xxlRpcProviderFactory);
114
+        servletServerHandler = new ServletServerHandler(xxlRpcProviderFactory);
116
     }
115
     }
117
     private void stopRpcProvider() throws Exception {
116
     private void stopRpcProvider() throws Exception {
118
         XxlRpcInvokerFactory.getInstance().stop();
117
         XxlRpcInvokerFactory.getInstance().stop();
119
     }
118
     }
120
     public static void invokeAdminService(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
119
     public static void invokeAdminService(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
121
-        jettyServerHandler.handle(null, new Request(null, null), request, response);
120
+        servletServerHandler.handle(null, request, response);
122
     }
121
     }
123
 
122
 
124
 
123
 
139
 
138
 
140
         // set-cache
139
         // set-cache
141
         executorBiz = (ExecutorBiz) new XxlRpcReferenceBean(
140
         executorBiz = (ExecutorBiz) new XxlRpcReferenceBean(
142
-                NetEnum.JETTY,
141
+                NetEnum.NETTY_HTTP,
143
                 Serializer.SerializeEnum.HESSIAN.getSerializer(),
142
                 Serializer.SerializeEnum.HESSIAN.getSerializer(),
144
                 CallType.SYNC,
143
                 CallType.SYNC,
145
                 LoadBalance.ROUND,
144
                 LoadBalance.ROUND,

+ 2 - 2
xxl-job-admin/src/test/java/com/xxl/job/adminbiz/AdminBizTest.java Wyświetl plik

33
     public void registryTest() throws Exception {
33
     public void registryTest() throws Exception {
34
         addressUrl = addressUrl.replace("http://", "");
34
         addressUrl = addressUrl.replace("http://", "");
35
         AdminBiz adminBiz = (AdminBiz) new XxlRpcReferenceBean(
35
         AdminBiz adminBiz = (AdminBiz) new XxlRpcReferenceBean(
36
-                NetEnum.JETTY,
36
+                NetEnum.NETTY_HTTP,
37
                 Serializer.SerializeEnum.HESSIAN.getSerializer(),
37
                 Serializer.SerializeEnum.HESSIAN.getSerializer(),
38
                 CallType.SYNC,
38
                 CallType.SYNC,
39
                 LoadBalance.ROUND,
39
                 LoadBalance.ROUND,
63
     public void registryRemove() throws Exception {
63
     public void registryRemove() throws Exception {
64
         addressUrl = addressUrl.replace("http://", "");
64
         addressUrl = addressUrl.replace("http://", "");
65
         AdminBiz adminBiz = (AdminBiz) new XxlRpcReferenceBean(
65
         AdminBiz adminBiz = (AdminBiz) new XxlRpcReferenceBean(
66
-                NetEnum.JETTY,
66
+                NetEnum.NETTY_HTTP,
67
                 Serializer.SerializeEnum.HESSIAN.getSerializer(),
67
                 Serializer.SerializeEnum.HESSIAN.getSerializer(),
68
                 CallType.SYNC,
68
                 CallType.SYNC,
69
                 LoadBalance.ROUND,
69
                 LoadBalance.ROUND,

+ 1 - 1
xxl-job-admin/src/test/java/com/xxl/job/executor/ExecutorBizTest.java Wyświetl plik

50
         // do remote trigger
50
         // do remote trigger
51
         String accessToken = null;
51
         String accessToken = null;
52
         ExecutorBiz executorBiz = (ExecutorBiz) new XxlRpcReferenceBean(
52
         ExecutorBiz executorBiz = (ExecutorBiz) new XxlRpcReferenceBean(
53
-                NetEnum.JETTY,
53
+                NetEnum.NETTY_HTTP,
54
                 Serializer.SerializeEnum.HESSIAN.getSerializer(),
54
                 Serializer.SerializeEnum.HESSIAN.getSerializer(),
55
                 CallType.SYNC,
55
                 CallType.SYNC,
56
                 LoadBalance.ROUND,
56
                 LoadBalance.ROUND,

+ 0 - 20
xxl-job-core/pom.xml Wyświetl plik

20
 			<groupId>com.xuxueli</groupId>
20
 			<groupId>com.xuxueli</groupId>
21
 			<artifactId>xxl-rpc-core</artifactId>
21
 			<artifactId>xxl-rpc-core</artifactId>
22
 			<version>${xxl-rpc.version}</version>
22
 			<version>${xxl-rpc.version}</version>
23
-			<exclusions>
24
-				<exclusion>
25
-					<groupId>io.netty</groupId>
26
-					<artifactId>netty-all</artifactId>
27
-				</exclusion>
28
-				<exclusion>
29
-					<groupId>org.apache.commons</groupId>
30
-					<artifactId>commons-pool2</artifactId>
31
-				</exclusion>
32
-			</exclusions>
33
-		</dependency>
34
-		<dependency>
35
-			<groupId>org.eclipse.jetty</groupId>
36
-			<artifactId>jetty-server</artifactId>
37
-			<version>${jetty-server.version}</version>
38
-		</dependency>
39
-		<dependency>
40
-			<groupId>org.eclipse.jetty</groupId>
41
-			<artifactId>jetty-client</artifactId>
42
-			<version>${jetty-server.version}</version>
43
 		</dependency>
23
 		</dependency>
44
 
24
 
45
 		<!-- groovy-all -->
25
 		<!-- groovy-all -->

+ 2 - 2
xxl-job-core/src/main/java/com/xxl/job/core/executor/XxlJobExecutor.java Wyświetl plik

115
                     String addressUrl = address.concat(AdminBiz.MAPPING);
115
                     String addressUrl = address.concat(AdminBiz.MAPPING);
116
 
116
 
117
                     AdminBiz adminBiz = (AdminBiz) new XxlRpcReferenceBean(
117
                     AdminBiz adminBiz = (AdminBiz) new XxlRpcReferenceBean(
118
-                            NetEnum.JETTY,
118
+                            NetEnum.NETTY_HTTP,
119
                             Serializer.SerializeEnum.HESSIAN.getSerializer(),
119
                             Serializer.SerializeEnum.HESSIAN.getSerializer(),
120
                             CallType.SYNC,
120
                             CallType.SYNC,
121
                             LoadBalance.ROUND,
121
                             LoadBalance.ROUND,
153
         serviceRegistryParam.put("address", address);
153
         serviceRegistryParam.put("address", address);
154
 
154
 
155
         xxlRpcProviderFactory = new XxlRpcProviderFactory();
155
         xxlRpcProviderFactory = new XxlRpcProviderFactory();
156
-        xxlRpcProviderFactory.initConfig(NetEnum.JETTY, Serializer.SerializeEnum.HESSIAN.getSerializer(), ip, port, accessToken, ExecutorServiceRegistry.class, serviceRegistryParam);
156
+        xxlRpcProviderFactory.initConfig(NetEnum.NETTY_HTTP, Serializer.SerializeEnum.HESSIAN.getSerializer(), ip, port, accessToken, ExecutorServiceRegistry.class, serviceRegistryParam);
157
 
157
 
158
         // add services
158
         // add services
159
         xxlRpcProviderFactory.addService(ExecutorBiz.class.getName(), null, new ExecutorBizImpl());
159
         xxlRpcProviderFactory.addService(ExecutorBiz.class.getName(), null, new ExecutorBizImpl());

+ 0 - 28
xxl-job-executor-samples/xxl-job-executor-sample-springboot/pom.xml Wyświetl plik

28
                 <type>pom</type>
28
                 <type>pom</type>
29
                 <scope>import</scope>
29
                 <scope>import</scope>
30
             </dependency>
30
             </dependency>
31
-
32
-            <!-- jetty -->
33
-            <dependency>
34
-                <groupId>org.eclipse.jetty</groupId>
35
-                <artifactId>jetty-server</artifactId>
36
-                <version>${jetty-server.version}</version>
37
-            </dependency>
38
-            <dependency>
39
-                <groupId>org.eclipse.jetty</groupId>
40
-                <artifactId>jetty-util</artifactId>
41
-                <version>${jetty-server.version}</version>
42
-            </dependency>
43
-            <dependency>
44
-                <groupId>org.eclipse.jetty</groupId>
45
-                <artifactId>jetty-http</artifactId>
46
-                <version>${jetty-server.version}</version>
47
-            </dependency>
48
-            <dependency>
49
-                <groupId>org.eclipse.jetty</groupId>
50
-                <artifactId>jetty-io</artifactId>
51
-                <version>${jetty-server.version}</version>
52
-            </dependency>
53
-            <dependency>
54
-                <groupId>org.eclipse.jetty</groupId>
55
-                <artifactId>jetty-client</artifactId>
56
-                <version>${jetty-server.version}</version>
57
-            </dependency>
58
-
59
         </dependencies>
31
         </dependencies>
60
     </dependencyManagement>
32
     </dependencyManagement>
61
 
33