diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000000000000000000000000000000000000..887c073b9fef280946ac9b5078c3ee9a6e98e376
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "李孟坤I(模块9作业)/code/dubbo-resource/dubbo"]
+ path = 李孟坤I(模块9作业)/code/dubbo-resource/dubbo
+ url = https://github.com/apache/dubbo.git
diff --git "a/\346\235\216\345\255\237\345\235\244(\346\250\241\345\235\227\345\233\233\344\275\234\344\270\232)/code/myspringboot/.idea/compiler.xml" "b/\346\235\216\345\255\237\345\235\244(\346\250\241\345\235\227\345\233\233\344\275\234\344\270\232)/code/myspringboot/.idea/compiler.xml"
new file mode 100644
index 0000000000000000000000000000000000000000..6836d451cb7f60b7d365a63d5f5560ccbe7850b0
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244(\346\250\241\345\235\227\345\233\233\344\275\234\344\270\232)/code/myspringboot/.idea/compiler.xml"
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git "a/\346\235\216\345\255\237\345\235\244(\346\250\241\345\235\227\345\233\233\344\275\234\344\270\232)/code/myspringboot/.idea/encodings.xml" "b/\346\235\216\345\255\237\345\235\244(\346\250\241\345\235\227\345\233\233\344\275\234\344\270\232)/code/myspringboot/.idea/encodings.xml"
new file mode 100644
index 0000000000000000000000000000000000000000..63e900193296f8ed911a1b9f5b051cf908099431
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244(\346\250\241\345\235\227\345\233\233\344\275\234\344\270\232)/code/myspringboot/.idea/encodings.xml"
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git "a/\346\235\216\345\255\237\345\235\244(\346\250\241\345\235\227\345\233\233\344\275\234\344\270\232)/code/myspringboot/.idea/misc.xml" "b/\346\235\216\345\255\237\345\235\244(\346\250\241\345\235\227\345\233\233\344\275\234\344\270\232)/code/myspringboot/.idea/misc.xml"
new file mode 100644
index 0000000000000000000000000000000000000000..32d5f87c3b608ba34a14c1ef0c3102054ce3f12e
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244(\346\250\241\345\235\227\345\233\233\344\275\234\344\270\232)/code/myspringboot/.idea/misc.xml"
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git "a/\346\235\216\345\255\237\345\235\244(\346\250\241\345\235\227\345\233\233\344\275\234\344\270\232)/code/myspringboot/.idea/uiDesigner.xml" "b/\346\235\216\345\255\237\345\235\244(\346\250\241\345\235\227\345\233\233\344\275\234\344\270\232)/code/myspringboot/.idea/uiDesigner.xml"
new file mode 100644
index 0000000000000000000000000000000000000000..e96534fb27b68192f27f985d3879e173ec77adb8
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244(\346\250\241\345\235\227\345\233\233\344\275\234\344\270\232)/code/myspringboot/.idea/uiDesigner.xml"
@@ -0,0 +1,124 @@
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+
\ No newline at end of file
diff --git "a/\346\235\216\345\255\237\345\235\244(\346\250\241\345\235\227\345\233\233\344\275\234\344\270\232)/code/myspringboot/.idea/workspace.xml" "b/\346\235\216\345\255\237\345\235\244(\346\250\241\345\235\227\345\233\233\344\275\234\344\270\232)/code/myspringboot/.idea/workspace.xml"
new file mode 100644
index 0000000000000000000000000000000000000000..a6bde235db725bdbaeedf44e14424252c18dabfa
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244(\346\250\241\345\235\227\345\233\233\344\275\234\344\270\232)/code/myspringboot/.idea/workspace.xml"
@@ -0,0 +1,157 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1621754137897
+
+
+ 1621754137897
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ file://$PROJECT_DIR$/src/main/java/com/zimu/controller/MyController.java
+ 12
+
+
+
+ file://$PROJECT_DIR$/src/main/java/com/zimu/config/MyWebApplicationInitializer.java
+ 19
+
+
+
+
+
+
\ No newline at end of file
diff --git "a/\346\235\216\345\255\237\345\235\244(\346\250\241\345\235\227\345\233\233\344\275\234\344\270\232)/code/myspringboot/myspringboot.iml" "b/\346\235\216\345\255\237\345\235\244(\346\250\241\345\235\227\345\233\233\344\275\234\344\270\232)/code/myspringboot/myspringboot.iml"
new file mode 100644
index 0000000000000000000000000000000000000000..78b2cc53b203f0b97534bb1184cdc7b474339fb4
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244(\346\250\241\345\235\227\345\233\233\344\275\234\344\270\232)/code/myspringboot/myspringboot.iml"
@@ -0,0 +1,2 @@
+
+
\ No newline at end of file
diff --git "a/\346\235\216\345\255\237\345\235\244(\346\250\241\345\235\227\345\233\233\344\275\234\344\270\232)/code/myspringboot/pom.xml" "b/\346\235\216\345\255\237\345\235\244(\346\250\241\345\235\227\345\233\233\344\275\234\344\270\232)/code/myspringboot/pom.xml"
new file mode 100644
index 0000000000000000000000000000000000000000..08c3f3a56e30b6d5ed1c695d1929ddbce51e73e2
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244(\346\250\241\345\235\227\345\233\233\344\275\234\344\270\232)/code/myspringboot/pom.xml"
@@ -0,0 +1,59 @@
+
+
+
+ 4.0.0
+
+ com.zimu
+ myspringboot
+ 1.0-SNAPSHOT
+ war
+
+ myspringboot Maven Webapp
+
+ http://www.example.com
+
+
+ UTF-8
+ 1.8
+ 1.8
+
+
+
+
+ org.springframework
+ spring-web
+ 5.0.8.RELEASE
+
+
+ org.apache.tomcat.embed
+ tomcat-embed-core
+ 8.5.32
+
+
+ org.springframework
+ spring-context
+ 5.0.8.RELEASE
+
+
+ org.springframework
+ spring-webmvc
+ 5.0.8.RELEASE
+
+
+ junit
+ junit
+ 4.11
+ test
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+
diff --git "a/\346\235\216\345\255\237\345\235\244(\346\250\241\345\235\227\345\233\233\344\275\234\344\270\232)/code/myspringboot/src/main/java/com/zimu/SpringApplication.java" "b/\346\235\216\345\255\237\345\235\244(\346\250\241\345\235\227\345\233\233\344\275\234\344\270\232)/code/myspringboot/src/main/java/com/zimu/SpringApplication.java"
new file mode 100644
index 0000000000000000000000000000000000000000..be97319e6150ca8adab453663c99f056ef0b1054
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244(\346\250\241\345\235\227\345\233\233\344\275\234\344\270\232)/code/myspringboot/src/main/java/com/zimu/SpringApplication.java"
@@ -0,0 +1,31 @@
+package com.zimu;
+
+import org.apache.catalina.LifecycleException;
+import org.apache.catalina.startup.Tomcat;
+
+import javax.servlet.ServletException;
+import javax.swing.*;
+
+/**
+ * Created by 梓沐 on 2021/5/23.
+ */
+public class SpringApplication {
+ public static void main(String[] args) {
+ SpringApplication.run();
+ }
+
+ private static void run() {
+ Tomcat tomcat = new Tomcat();
+ tomcat.setPort(8000);
+ try {
+ //设置项目文件路径
+ tomcat.addWebapp("/","D:\\");
+ //启动tomcat
+ tomcat.start();
+ //监听关闭端口。阻塞式,没有这一局。方法执行完会直接结束
+ tomcat.getServer().await();
+ }catch (LifecycleException | ServletException e){
+ e.printStackTrace();
+ }
+ }
+}
diff --git "a/\346\235\216\345\255\237\345\235\244(\346\250\241\345\235\227\345\233\233\344\275\234\344\270\232)/code/myspringboot/src/main/java/com/zimu/config/AppConfig.java" "b/\346\235\216\345\255\237\345\235\244(\346\250\241\345\235\227\345\233\233\344\275\234\344\270\232)/code/myspringboot/src/main/java/com/zimu/config/AppConfig.java"
new file mode 100644
index 0000000000000000000000000000000000000000..d9d842291f9580e1bd371656bdab37cc536375ba
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244(\346\250\241\345\235\227\345\233\233\344\275\234\344\270\232)/code/myspringboot/src/main/java/com/zimu/config/AppConfig.java"
@@ -0,0 +1,14 @@
+package com.zimu.config;
+
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.Configuration;
+
+/**
+ * Created by 梓沐 on 2021/5/23.
+ */
+@Configuration
+@ComponentScan("com.zimu")
+public class AppConfig {
+
+
+}
diff --git "a/\346\235\216\345\255\237\345\235\244(\346\250\241\345\235\227\345\233\233\344\275\234\344\270\232)/code/myspringboot/src/main/java/com/zimu/config/MyWebApplicationInitializer.java" "b/\346\235\216\345\255\237\345\235\244(\346\250\241\345\235\227\345\233\233\344\275\234\344\270\232)/code/myspringboot/src/main/java/com/zimu/config/MyWebApplicationInitializer.java"
new file mode 100644
index 0000000000000000000000000000000000000000..b3e635092e7ec7bd81aecc2e15d5908decd93cb4
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244(\346\250\241\345\235\227\345\233\233\344\275\234\344\270\232)/code/myspringboot/src/main/java/com/zimu/config/MyWebApplicationInitializer.java"
@@ -0,0 +1,28 @@
+package com.zimu.config;
+
+import org.springframework.web.WebApplicationInitializer;
+import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
+import org.springframework.web.servlet.DispatcherServlet;
+
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRegistration;
+
+/**
+ * Created by 梓沐 on 2021/5/23.
+ */
+//SpringServletContainerInitializer在Servlet启动的时候,会自动探测WebApplicationInitializer下的实现类并执行对应的onStartup方法
+public class MyWebApplicationInitializer implements WebApplicationInitializer {
+ @Override
+ public void onStartup(ServletContext servletContext) throws ServletException {
+ System.out.println("调用MyWebApplicationInitializer了");
+ //通过注解的方式初始化spring的上下文
+ AnnotationConfigWebApplicationContext annotationConfigWebApplicationContext = new AnnotationConfigWebApplicationContext();
+ annotationConfigWebApplicationContext.register(AppConfig.class);
+ annotationConfigWebApplicationContext.refresh();
+ DispatcherServlet dispatcherServlet = new DispatcherServlet(annotationConfigWebApplicationContext);
+ ServletRegistration.Dynamic registration = servletContext.addServlet("/app", dispatcherServlet);
+ registration.setLoadOnStartup(1);
+ registration.addMapping("/app/*");
+ }
+}
diff --git "a/\346\235\216\345\255\237\345\235\244(\346\250\241\345\235\227\345\233\233\344\275\234\344\270\232)/code/myspringboot/src/main/java/com/zimu/controller/MyController.java" "b/\346\235\216\345\255\237\345\235\244(\346\250\241\345\235\227\345\233\233\344\275\234\344\270\232)/code/myspringboot/src/main/java/com/zimu/controller/MyController.java"
new file mode 100644
index 0000000000000000000000000000000000000000..5822e277c4f2454afb10ba843a7b230d6d14ac94
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244(\346\250\241\345\235\227\345\233\233\344\275\234\344\270\232)/code/myspringboot/src/main/java/com/zimu/controller/MyController.java"
@@ -0,0 +1,16 @@
+package com.zimu.controller;
+
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * Created by 梓沐 on 2021/5/23.
+ */
+@RestController
+public class MyController {
+ @RequestMapping("/test")
+ public String testHandler(){
+ System.out.println("test");
+ return "test";
+ }
+}
diff --git "a/\346\235\216\345\255\237\345\235\244(\346\250\241\345\235\227\345\233\233\344\275\234\344\270\232)/code/myspringboot/target/classes/com/zimu/SpringApplication.class" "b/\346\235\216\345\255\237\345\235\244(\346\250\241\345\235\227\345\233\233\344\275\234\344\270\232)/code/myspringboot/target/classes/com/zimu/SpringApplication.class"
new file mode 100644
index 0000000000000000000000000000000000000000..d4c92a27e83cab1b9be63cd6d5f0bc57b6b0a4f3
Binary files /dev/null and "b/\346\235\216\345\255\237\345\235\244(\346\250\241\345\235\227\345\233\233\344\275\234\344\270\232)/code/myspringboot/target/classes/com/zimu/SpringApplication.class" differ
diff --git "a/\346\235\216\345\255\237\345\235\244(\346\250\241\345\235\227\345\233\233\344\275\234\344\270\232)/code/myspringboot/target/classes/com/zimu/config/AppConfig.class" "b/\346\235\216\345\255\237\345\235\244(\346\250\241\345\235\227\345\233\233\344\275\234\344\270\232)/code/myspringboot/target/classes/com/zimu/config/AppConfig.class"
new file mode 100644
index 0000000000000000000000000000000000000000..b134ba6605d4930f8c6d5e2b95057229752c501c
Binary files /dev/null and "b/\346\235\216\345\255\237\345\235\244(\346\250\241\345\235\227\345\233\233\344\275\234\344\270\232)/code/myspringboot/target/classes/com/zimu/config/AppConfig.class" differ
diff --git "a/\346\235\216\345\255\237\345\235\244(\346\250\241\345\235\227\345\233\233\344\275\234\344\270\232)/code/myspringboot/target/classes/com/zimu/config/MyWebApplicationInitializer.class" "b/\346\235\216\345\255\237\345\235\244(\346\250\241\345\235\227\345\233\233\344\275\234\344\270\232)/code/myspringboot/target/classes/com/zimu/config/MyWebApplicationInitializer.class"
new file mode 100644
index 0000000000000000000000000000000000000000..e786c65b94e489ed02d9f00064b12ef9d5a3b0a5
Binary files /dev/null and "b/\346\235\216\345\255\237\345\235\244(\346\250\241\345\235\227\345\233\233\344\275\234\344\270\232)/code/myspringboot/target/classes/com/zimu/config/MyWebApplicationInitializer.class" differ
diff --git "a/\346\235\216\345\255\237\345\235\244(\346\250\241\345\235\227\345\233\233\344\275\234\344\270\232)/code/myspringboot/target/classes/com/zimu/controller/MyController.class" "b/\346\235\216\345\255\237\345\235\244(\346\250\241\345\235\227\345\233\233\344\275\234\344\270\232)/code/myspringboot/target/classes/com/zimu/controller/MyController.class"
new file mode 100644
index 0000000000000000000000000000000000000000..7274ea0eed489a14d93eafe31d8d0c55d5d88893
Binary files /dev/null and "b/\346\235\216\345\255\237\345\235\244(\346\250\241\345\235\227\345\233\233\344\275\234\344\270\232)/code/myspringboot/target/classes/com/zimu/controller/MyController.class" differ
diff --git "a/\346\235\216\345\255\237\345\235\244(\346\250\241\345\235\227\345\233\233\344\275\234\344\270\232)/\351\252\214\350\257\201\350\265\204\346\226\231/20210523_165943.mp4" "b/\346\235\216\345\255\237\345\235\244(\346\250\241\345\235\227\345\233\233\344\275\234\344\270\232)/\351\252\214\350\257\201\350\265\204\346\226\231/20210523_165943.mp4"
new file mode 100644
index 0000000000000000000000000000000000000000..075074da5c1c00935b6f3ca6ee6dc79a97a7c810
Binary files /dev/null and "b/\346\235\216\345\255\237\345\235\244(\346\250\241\345\235\227\345\233\233\344\275\234\344\270\232)/\351\252\214\350\257\201\350\265\204\346\226\231/20210523_165943.mp4" differ
diff --git "a/\346\235\216\345\255\237\345\235\244(\346\250\241\345\235\227\345\233\233\344\275\234\344\270\232)/\351\252\214\350\257\201\350\265\204\346\226\231/SpringBoot.pdf" "b/\346\235\216\345\255\237\345\235\244(\346\250\241\345\235\227\345\233\233\344\275\234\344\270\232)/\351\252\214\350\257\201\350\265\204\346\226\231/SpringBoot.pdf"
new file mode 100644
index 0000000000000000000000000000000000000000..02d93ae7df1e5a21a9b7511184b6536dd07bf67e
Binary files /dev/null and "b/\346\235\216\345\255\237\345\235\244(\346\250\241\345\235\227\345\233\233\344\275\234\344\270\232)/\351\252\214\350\257\201\350\265\204\346\226\231/SpringBoot.pdf" differ
diff --git "a/\346\235\216\345\255\237\345\235\244(\346\250\241\345\235\227\345\233\233\344\275\234\344\270\232)/\351\252\214\350\257\201\350\265\204\346\226\231/SpringBoot\346\272\220\347\240\201\345\210\206\346\236\220.pdf" "b/\346\235\216\345\255\237\345\235\244(\346\250\241\345\235\227\345\233\233\344\275\234\344\270\232)/\351\252\214\350\257\201\350\265\204\346\226\231/SpringBoot\346\272\220\347\240\201\345\210\206\346\236\220.pdf"
new file mode 100644
index 0000000000000000000000000000000000000000..cc51da7a77eb34de35cf6590936810eaa0c3b9ef
Binary files /dev/null and "b/\346\235\216\345\255\237\345\235\244(\346\250\241\345\235\227\345\233\233\344\275\234\344\270\232)/\351\252\214\350\257\201\350\265\204\346\226\231/SpringBoot\346\272\220\347\240\201\345\210\206\346\236\220.pdf" differ
diff --git "a/\346\235\216\345\255\237\345\235\244(\346\250\241\345\235\227\345\233\233\344\275\234\344\270\232)/\351\252\214\350\257\201\350\265\204\346\226\231/SpringBoot\351\203\250\347\275\262\344\270\216\347\233\221\346\216\247.pdf" "b/\346\235\216\345\255\237\345\235\244(\346\250\241\345\235\227\345\233\233\344\275\234\344\270\232)/\351\252\214\350\257\201\350\265\204\346\226\231/SpringBoot\351\203\250\347\275\262\344\270\216\347\233\221\346\216\247.pdf"
new file mode 100644
index 0000000000000000000000000000000000000000..e59fddfb3f0622ff1449b454f6c57351da544e6b
Binary files /dev/null and "b/\346\235\216\345\255\237\345\235\244(\346\250\241\345\235\227\345\233\233\344\275\234\344\270\232)/\351\252\214\350\257\201\350\265\204\346\226\231/SpringBoot\351\203\250\347\275\262\344\270\216\347\233\221\346\216\247.pdf" differ
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/persist_Myrpc/.gitignore" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/persist_Myrpc/.gitignore"
new file mode 100644
index 0000000000000000000000000000000000000000..549e00a2a96fa9d7c5dbc9859664a78d980158c2
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/persist_Myrpc/.gitignore"
@@ -0,0 +1,33 @@
+HELP.md
+target/
+!.mvn/wrapper/maven-wrapper.jar
+!**/src/main/**/target/
+!**/src/test/**/target/
+
+### STS ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+.sts4-cache
+
+### IntelliJ IDEA ###
+.idea
+*.iws
+*.iml
+*.ipr
+
+### NetBeans ###
+/nbproject/private/
+/nbbuild/
+/dist/
+/nbdist/
+/.nb-gradle/
+build/
+!**/src/main/**/build/
+!**/src/test/**/build/
+
+### VS Code ###
+.vscode/
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/persist_Myrpc/.mvn/wrapper/MavenWrapperDownloader.java" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/persist_Myrpc/.mvn/wrapper/MavenWrapperDownloader.java"
new file mode 100644
index 0000000000000000000000000000000000000000..a45eb6ba269cd38f8965cef786729790945d9537
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/persist_Myrpc/.mvn/wrapper/MavenWrapperDownloader.java"
@@ -0,0 +1,118 @@
+/*
+ * Copyright 2007-present the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.net.*;
+import java.io.*;
+import java.nio.channels.*;
+import java.util.Properties;
+
+public class MavenWrapperDownloader {
+
+ private static final String WRAPPER_VERSION = "0.5.6";
+ /**
+ * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
+ */
+ private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/"
+ + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar";
+
+ /**
+ * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
+ * use instead of the default one.
+ */
+ private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
+ ".mvn/wrapper/maven-wrapper.properties";
+
+ /**
+ * Path where the maven-wrapper.jar will be saved to.
+ */
+ private static final String MAVEN_WRAPPER_JAR_PATH =
+ ".mvn/wrapper/maven-wrapper.jar";
+
+ /**
+ * Name of the property which should be used to override the default download url for the wrapper.
+ */
+ private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
+
+ public static void main(String args[]) {
+ System.out.println("- Downloader started");
+ File baseDirectory = new File(args[0]);
+ System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
+
+ // If the maven-wrapper.properties exists, read it and check if it contains a custom
+ // wrapperUrl parameter.
+ File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
+ String url = DEFAULT_DOWNLOAD_URL;
+ if (mavenWrapperPropertyFile.exists()) {
+ FileInputStream mavenWrapperPropertyFileInputStream = null;
+ try {
+ mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
+ Properties mavenWrapperProperties = new Properties();
+ mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
+ url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
+ } catch (IOException e) {
+ System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
+ } finally {
+ try {
+ if (mavenWrapperPropertyFileInputStream != null) {
+ mavenWrapperPropertyFileInputStream.close();
+ }
+ } catch (IOException e) {
+ // Ignore ...
+ }
+ }
+ }
+ System.out.println("- Downloading from: " + url);
+
+ File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
+ if (!outputFile.getParentFile().exists()) {
+ if (!outputFile.getParentFile().mkdirs()) {
+ System.out.println(
+ "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'");
+ }
+ }
+ System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
+ try {
+ downloadFileFromURL(url, outputFile);
+ System.out.println("Done");
+ System.exit(0);
+ } catch (Throwable e) {
+ System.out.println("- Error downloading");
+ e.printStackTrace();
+ System.exit(1);
+ }
+ }
+
+ private static void downloadFileFromURL(String urlString, File destination) throws Exception {
+ if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
+ String username = System.getenv("MVNW_USERNAME");
+ char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
+ Authenticator.setDefault(new Authenticator() {
+ @Override
+ protected PasswordAuthentication getPasswordAuthentication() {
+ return new PasswordAuthentication(username, password);
+ }
+ });
+ }
+ URL website = new URL(urlString);
+ ReadableByteChannel rbc;
+ rbc = Channels.newChannel(website.openStream());
+ FileOutputStream fos = new FileOutputStream(destination);
+ fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
+ fos.close();
+ rbc.close();
+ }
+
+}
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/persist_Myrpc/.mvn/wrapper/maven-wrapper.jar" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/persist_Myrpc/.mvn/wrapper/maven-wrapper.jar"
new file mode 100644
index 0000000000000000000000000000000000000000..2cc7d4a55c0cd0092912bf49ae38b3a9e3fd0054
Binary files /dev/null and "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/persist_Myrpc/.mvn/wrapper/maven-wrapper.jar" differ
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/persist_Myrpc/.mvn/wrapper/maven-wrapper.properties" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/persist_Myrpc/.mvn/wrapper/maven-wrapper.properties"
new file mode 100644
index 0000000000000000000000000000000000000000..ffdc10e59f87823d5abb635aa2e37bf281698e83
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/persist_Myrpc/.mvn/wrapper/maven-wrapper.properties"
@@ -0,0 +1,2 @@
+distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.1/apache-maven-3.8.1-bin.zip
+wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/persist_Myrpc/mvnw" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/persist_Myrpc/mvnw"
new file mode 100644
index 0000000000000000000000000000000000000000..a16b5431b4c3cab50323a3f558003fd0abd87dad
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/persist_Myrpc/mvnw"
@@ -0,0 +1,310 @@
+#!/bin/sh
+# ----------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# ----------------------------------------------------------------------------
+
+# ----------------------------------------------------------------------------
+# Maven Start Up Batch script
+#
+# Required ENV vars:
+# ------------------
+# JAVA_HOME - location of a JDK home dir
+#
+# Optional ENV vars
+# -----------------
+# M2_HOME - location of maven2's installed home dir
+# MAVEN_OPTS - parameters passed to the Java VM when running Maven
+# e.g. to debug Maven itself, use
+# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
+# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
+# ----------------------------------------------------------------------------
+
+if [ -z "$MAVEN_SKIP_RC" ] ; then
+
+ if [ -f /etc/mavenrc ] ; then
+ . /etc/mavenrc
+ fi
+
+ if [ -f "$HOME/.mavenrc" ] ; then
+ . "$HOME/.mavenrc"
+ fi
+
+fi
+
+# OS specific support. $var _must_ be set to either true or false.
+cygwin=false;
+darwin=false;
+mingw=false
+case "`uname`" in
+ CYGWIN*) cygwin=true ;;
+ MINGW*) mingw=true;;
+ Darwin*) darwin=true
+ # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
+ # See https://developer.apple.com/library/mac/qa/qa1170/_index.html
+ if [ -z "$JAVA_HOME" ]; then
+ if [ -x "/usr/libexec/java_home" ]; then
+ export JAVA_HOME="`/usr/libexec/java_home`"
+ else
+ export JAVA_HOME="/Library/Java/Home"
+ fi
+ fi
+ ;;
+esac
+
+if [ -z "$JAVA_HOME" ] ; then
+ if [ -r /etc/gentoo-release ] ; then
+ JAVA_HOME=`java-config --jre-home`
+ fi
+fi
+
+if [ -z "$M2_HOME" ] ; then
+ ## resolve links - $0 may be a link to maven's home
+ PRG="$0"
+
+ # need this for relative symlinks
+ while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG="`dirname "$PRG"`/$link"
+ fi
+ done
+
+ saveddir=`pwd`
+
+ M2_HOME=`dirname "$PRG"`/..
+
+ # make it fully qualified
+ M2_HOME=`cd "$M2_HOME" && pwd`
+
+ cd "$saveddir"
+ # echo Using m2 at $M2_HOME
+fi
+
+# For Cygwin, ensure paths are in UNIX format before anything is touched
+if $cygwin ; then
+ [ -n "$M2_HOME" ] &&
+ M2_HOME=`cygpath --unix "$M2_HOME"`
+ [ -n "$JAVA_HOME" ] &&
+ JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
+ [ -n "$CLASSPATH" ] &&
+ CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
+fi
+
+# For Mingw, ensure paths are in UNIX format before anything is touched
+if $mingw ; then
+ [ -n "$M2_HOME" ] &&
+ M2_HOME="`(cd "$M2_HOME"; pwd)`"
+ [ -n "$JAVA_HOME" ] &&
+ JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
+fi
+
+if [ -z "$JAVA_HOME" ]; then
+ javaExecutable="`which javac`"
+ if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
+ # readlink(1) is not available as standard on Solaris 10.
+ readLink=`which readlink`
+ if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
+ if $darwin ; then
+ javaHome="`dirname \"$javaExecutable\"`"
+ javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
+ else
+ javaExecutable="`readlink -f \"$javaExecutable\"`"
+ fi
+ javaHome="`dirname \"$javaExecutable\"`"
+ javaHome=`expr "$javaHome" : '\(.*\)/bin'`
+ JAVA_HOME="$javaHome"
+ export JAVA_HOME
+ fi
+ fi
+fi
+
+if [ -z "$JAVACMD" ] ; then
+ if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ else
+ JAVACMD="`which java`"
+ fi
+fi
+
+if [ ! -x "$JAVACMD" ] ; then
+ echo "Error: JAVA_HOME is not defined correctly." >&2
+ echo " We cannot execute $JAVACMD" >&2
+ exit 1
+fi
+
+if [ -z "$JAVA_HOME" ] ; then
+ echo "Warning: JAVA_HOME environment variable is not set."
+fi
+
+CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
+
+# traverses directory structure from process work directory to filesystem root
+# first directory with .mvn subdirectory is considered project base directory
+find_maven_basedir() {
+
+ if [ -z "$1" ]
+ then
+ echo "Path not specified to find_maven_basedir"
+ return 1
+ fi
+
+ basedir="$1"
+ wdir="$1"
+ while [ "$wdir" != '/' ] ; do
+ if [ -d "$wdir"/.mvn ] ; then
+ basedir=$wdir
+ break
+ fi
+ # workaround for JBEAP-8937 (on Solaris 10/Sparc)
+ if [ -d "${wdir}" ]; then
+ wdir=`cd "$wdir/.."; pwd`
+ fi
+ # end of workaround
+ done
+ echo "${basedir}"
+}
+
+# concatenates all lines of a file
+concat_lines() {
+ if [ -f "$1" ]; then
+ echo "$(tr -s '\n' ' ' < "$1")"
+ fi
+}
+
+BASE_DIR=`find_maven_basedir "$(pwd)"`
+if [ -z "$BASE_DIR" ]; then
+ exit 1;
+fi
+
+##########################################################################################
+# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
+# This allows using the maven wrapper in projects that prohibit checking in binary data.
+##########################################################################################
+if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then
+ if [ "$MVNW_VERBOSE" = true ]; then
+ echo "Found .mvn/wrapper/maven-wrapper.jar"
+ fi
+else
+ if [ "$MVNW_VERBOSE" = true ]; then
+ echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
+ fi
+ if [ -n "$MVNW_REPOURL" ]; then
+ jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
+ else
+ jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
+ fi
+ while IFS="=" read key value; do
+ case "$key" in (wrapperUrl) jarUrl="$value"; break ;;
+ esac
+ done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties"
+ if [ "$MVNW_VERBOSE" = true ]; then
+ echo "Downloading from: $jarUrl"
+ fi
+ wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
+ if $cygwin; then
+ wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"`
+ fi
+
+ if command -v wget > /dev/null; then
+ if [ "$MVNW_VERBOSE" = true ]; then
+ echo "Found wget ... using wget"
+ fi
+ if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
+ wget "$jarUrl" -O "$wrapperJarPath"
+ else
+ wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath"
+ fi
+ elif command -v curl > /dev/null; then
+ if [ "$MVNW_VERBOSE" = true ]; then
+ echo "Found curl ... using curl"
+ fi
+ if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
+ curl -o "$wrapperJarPath" "$jarUrl" -f
+ else
+ curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f
+ fi
+
+ else
+ if [ "$MVNW_VERBOSE" = true ]; then
+ echo "Falling back to using Java to download"
+ fi
+ javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
+ # For Cygwin, switch paths to Windows format before running javac
+ if $cygwin; then
+ javaClass=`cygpath --path --windows "$javaClass"`
+ fi
+ if [ -e "$javaClass" ]; then
+ if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
+ if [ "$MVNW_VERBOSE" = true ]; then
+ echo " - Compiling MavenWrapperDownloader.java ..."
+ fi
+ # Compiling the Java class
+ ("$JAVA_HOME/bin/javac" "$javaClass")
+ fi
+ if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
+ # Running the downloader
+ if [ "$MVNW_VERBOSE" = true ]; then
+ echo " - Running MavenWrapperDownloader.java ..."
+ fi
+ ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR")
+ fi
+ fi
+ fi
+fi
+##########################################################################################
+# End of extension
+##########################################################################################
+
+export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
+if [ "$MVNW_VERBOSE" = true ]; then
+ echo $MAVEN_PROJECTBASEDIR
+fi
+MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin; then
+ [ -n "$M2_HOME" ] &&
+ M2_HOME=`cygpath --path --windows "$M2_HOME"`
+ [ -n "$JAVA_HOME" ] &&
+ JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
+ [ -n "$CLASSPATH" ] &&
+ CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
+ [ -n "$MAVEN_PROJECTBASEDIR" ] &&
+ MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
+fi
+
+# Provide a "standardized" way to retrieve the CLI args that will
+# work with both Windows and non-Windows executions.
+MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
+export MAVEN_CMD_LINE_ARGS
+
+WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
+
+exec "$JAVACMD" \
+ $MAVEN_OPTS \
+ -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
+ "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
+ ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/persist_Myrpc/mvnw.cmd" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/persist_Myrpc/mvnw.cmd"
new file mode 100644
index 0000000000000000000000000000000000000000..c8d43372c986d97911cdc21bd87e0cbe3d83bdda
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/persist_Myrpc/mvnw.cmd"
@@ -0,0 +1,182 @@
+@REM ----------------------------------------------------------------------------
+@REM Licensed to the Apache Software Foundation (ASF) under one
+@REM or more contributor license agreements. See the NOTICE file
+@REM distributed with this work for additional information
+@REM regarding copyright ownership. The ASF licenses this file
+@REM to you under the Apache License, Version 2.0 (the
+@REM "License"); you may not use this file except in compliance
+@REM with the License. You may obtain a copy of the License at
+@REM
+@REM https://www.apache.org/licenses/LICENSE-2.0
+@REM
+@REM Unless required by applicable law or agreed to in writing,
+@REM software distributed under the License is distributed on an
+@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+@REM KIND, either express or implied. See the License for the
+@REM specific language governing permissions and limitations
+@REM under the License.
+@REM ----------------------------------------------------------------------------
+
+@REM ----------------------------------------------------------------------------
+@REM Maven Start Up Batch script
+@REM
+@REM Required ENV vars:
+@REM JAVA_HOME - location of a JDK home dir
+@REM
+@REM Optional ENV vars
+@REM M2_HOME - location of maven2's installed home dir
+@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
+@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending
+@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
+@REM e.g. to debug Maven itself, use
+@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
+@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
+@REM ----------------------------------------------------------------------------
+
+@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
+@echo off
+@REM set title of command window
+title %0
+@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
+@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
+
+@REM set %HOME% to equivalent of $HOME
+if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
+
+@REM Execute a user defined script before this one
+if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
+@REM check for pre script, once with legacy .bat ending and once with .cmd ending
+if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
+if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
+:skipRcPre
+
+@setlocal
+
+set ERROR_CODE=0
+
+@REM To isolate internal variables from possible post scripts, we use another setlocal
+@setlocal
+
+@REM ==== START VALIDATION ====
+if not "%JAVA_HOME%" == "" goto OkJHome
+
+echo.
+echo Error: JAVA_HOME not found in your environment. >&2
+echo Please set the JAVA_HOME variable in your environment to match the >&2
+echo location of your Java installation. >&2
+echo.
+goto error
+
+:OkJHome
+if exist "%JAVA_HOME%\bin\java.exe" goto init
+
+echo.
+echo Error: JAVA_HOME is set to an invalid directory. >&2
+echo JAVA_HOME = "%JAVA_HOME%" >&2
+echo Please set the JAVA_HOME variable in your environment to match the >&2
+echo location of your Java installation. >&2
+echo.
+goto error
+
+@REM ==== END VALIDATION ====
+
+:init
+
+@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
+@REM Fallback to current working directory if not found.
+
+set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
+IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
+
+set EXEC_DIR=%CD%
+set WDIR=%EXEC_DIR%
+:findBaseDir
+IF EXIST "%WDIR%"\.mvn goto baseDirFound
+cd ..
+IF "%WDIR%"=="%CD%" goto baseDirNotFound
+set WDIR=%CD%
+goto findBaseDir
+
+:baseDirFound
+set MAVEN_PROJECTBASEDIR=%WDIR%
+cd "%EXEC_DIR%"
+goto endDetectBaseDir
+
+:baseDirNotFound
+set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
+cd "%EXEC_DIR%"
+
+:endDetectBaseDir
+
+IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
+
+@setlocal EnableExtensions EnableDelayedExpansion
+for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
+@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
+
+:endReadAdditionalConfig
+
+SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
+set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
+set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
+
+set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
+
+FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
+ IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
+)
+
+@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
+@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
+if exist %WRAPPER_JAR% (
+ if "%MVNW_VERBOSE%" == "true" (
+ echo Found %WRAPPER_JAR%
+ )
+) else (
+ if not "%MVNW_REPOURL%" == "" (
+ SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
+ )
+ if "%MVNW_VERBOSE%" == "true" (
+ echo Couldn't find %WRAPPER_JAR%, downloading it ...
+ echo Downloading from: %DOWNLOAD_URL%
+ )
+
+ powershell -Command "&{"^
+ "$webclient = new-object System.Net.WebClient;"^
+ "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
+ "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
+ "}"^
+ "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^
+ "}"
+ if "%MVNW_VERBOSE%" == "true" (
+ echo Finished downloading %WRAPPER_JAR%
+ )
+)
+@REM End of extension
+
+@REM Provide a "standardized" way to retrieve the CLI args that will
+@REM work with both Windows and non-Windows executions.
+set MAVEN_CMD_LINE_ARGS=%*
+
+%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
+if ERRORLEVEL 1 goto error
+goto end
+
+:error
+set ERROR_CODE=1
+
+:end
+@endlocal & set ERROR_CODE=%ERROR_CODE%
+
+if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
+@REM check for post script, once with legacy .bat ending and once with .cmd ending
+if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
+if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
+:skipRcPost
+
+@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
+if "%MAVEN_BATCH_PAUSE%" == "on" pause
+
+if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
+
+exit /B %ERROR_CODE%
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/persist_Myrpc/netty_server/pom.xml" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/persist_Myrpc/netty_server/pom.xml"
new file mode 100644
index 0000000000000000000000000000000000000000..e8d1b3343a5996fff9b242996623f179802c4614
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/persist_Myrpc/netty_server/pom.xml"
@@ -0,0 +1,15 @@
+
+
+
+ persist_rpc
+ com.zimu
+ 0.0.1-SNAPSHOT
+
+ 4.0.0
+
+ netty_server
+
+
+
\ No newline at end of file
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/persist_Myrpc/netty_server/src/main/java/com/zimu/handler/NettyServerHandler1.java" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/persist_Myrpc/netty_server/src/main/java/com/zimu/handler/NettyServerHandler1.java"
new file mode 100644
index 0000000000000000000000000000000000000000..d50590bb8c7c78574cd96cc219479a62f640a120
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/persist_Myrpc/netty_server/src/main/java/com/zimu/handler/NettyServerHandler1.java"
@@ -0,0 +1,84 @@
+package com.zimu.handler;
+
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.Unpooled;
+import io.netty.channel.ChannelHandlerContext;
+import io.netty.channel.ChannelInboundHandler;
+import io.netty.util.CharsetUtil;
+
+/**
+ * 自定义服务端通道入站handler
+ * Created by 梓沐 on 2021/6/29.
+ */
+public class NettyServerHandler1 implements ChannelInboundHandler {
+
+ /**
+ * 通道读取事件
+ * @param channelHandlerContext
+ * @param o
+ * @throws Exception
+ */
+ @Override
+ public void channelRead(ChannelHandlerContext channelHandlerContext, Object o) throws Exception {
+ ByteBuf byteBuf = (ByteBuf) o;
+ System.out.println("客户端发来消息" + byteBuf.toString(CharsetUtil.UTF_8));
+
+ }
+
+ /**
+ * 读取完毕事件
+ * @param channelHandlerContext
+ * @throws Exception
+ */
+ @Override
+ public void channelReadComplete(ChannelHandlerContext channelHandlerContext) throws Exception {
+ channelHandlerContext.writeAndFlush(Unpooled.copiedBuffer("{result:1}", CharsetUtil.UTF_8));
+ }
+
+ @Override
+ public void exceptionCaught(ChannelHandlerContext channelHandlerContext, Throwable throwable) throws Exception {
+ throwable.printStackTrace();
+ channelHandlerContext.close();
+ }
+
+ @Override
+ public void channelRegistered(ChannelHandlerContext channelHandlerContext) throws Exception {
+
+ }
+
+ @Override
+ public void channelUnregistered(ChannelHandlerContext channelHandlerContext) throws Exception {
+
+ }
+
+ @Override
+ public void channelActive(ChannelHandlerContext channelHandlerContext) throws Exception {
+
+ }
+
+ @Override
+ public void channelInactive(ChannelHandlerContext channelHandlerContext) throws Exception {
+
+ }
+
+
+ @Override
+ public void userEventTriggered(ChannelHandlerContext channelHandlerContext, Object o) throws Exception {
+
+ }
+
+ @Override
+ public void channelWritabilityChanged(ChannelHandlerContext channelHandlerContext) throws Exception {
+
+ }
+
+ @Override
+ public void handlerAdded(ChannelHandlerContext channelHandlerContext) throws Exception {
+
+ }
+
+ @Override
+ public void handlerRemoved(ChannelHandlerContext channelHandlerContext) throws Exception {
+
+ }
+}
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/persist_Myrpc/netty_server/src/main/java/com/zimu/handler/NettyServerHandler2.java" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/persist_Myrpc/netty_server/src/main/java/com/zimu/handler/NettyServerHandler2.java"
new file mode 100644
index 0000000000000000000000000000000000000000..247428bbe8b2b5700bb110d462efd09fd99d75ea
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/persist_Myrpc/netty_server/src/main/java/com/zimu/handler/NettyServerHandler2.java"
@@ -0,0 +1,84 @@
+package com.zimu.handler;
+
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.Unpooled;
+import io.netty.channel.ChannelHandlerContext;
+import io.netty.channel.ChannelInboundHandler;
+import io.netty.util.CharsetUtil;
+
+/**
+ * 自定义服务端通道入站handler
+ * Created by 梓沐 on 2021/6/29.
+ */
+public class NettyServerHandler2 implements ChannelInboundHandler {
+
+ /**
+ * 通道读取事件
+ * @param channelHandlerContext
+ * @param o
+ * @throws Exception
+ */
+ @Override
+ public void channelRead(ChannelHandlerContext channelHandlerContext, Object o) throws Exception {
+ ByteBuf byteBuf = (ByteBuf) o;
+ System.out.println("客户端发来消息" + byteBuf.toString(CharsetUtil.UTF_8));
+
+ }
+
+ /**
+ * 读取完毕事件
+ * @param channelHandlerContext
+ * @throws Exception
+ */
+ @Override
+ public void channelReadComplete(ChannelHandlerContext channelHandlerContext) throws Exception {
+ channelHandlerContext.writeAndFlush(Unpooled.copiedBuffer("{result:2}", CharsetUtil.UTF_8));
+ }
+
+ @Override
+ public void exceptionCaught(ChannelHandlerContext channelHandlerContext, Throwable throwable) throws Exception {
+ throwable.printStackTrace();
+ channelHandlerContext.close();
+ }
+
+ @Override
+ public void channelRegistered(ChannelHandlerContext channelHandlerContext) throws Exception {
+
+ }
+
+ @Override
+ public void channelUnregistered(ChannelHandlerContext channelHandlerContext) throws Exception {
+
+ }
+
+ @Override
+ public void channelActive(ChannelHandlerContext channelHandlerContext) throws Exception {
+
+ }
+
+ @Override
+ public void channelInactive(ChannelHandlerContext channelHandlerContext) throws Exception {
+
+ }
+
+
+ @Override
+ public void userEventTriggered(ChannelHandlerContext channelHandlerContext, Object o) throws Exception {
+
+ }
+
+ @Override
+ public void channelWritabilityChanged(ChannelHandlerContext channelHandlerContext) throws Exception {
+
+ }
+
+ @Override
+ public void handlerAdded(ChannelHandlerContext channelHandlerContext) throws Exception {
+
+ }
+
+ @Override
+ public void handlerRemoved(ChannelHandlerContext channelHandlerContext) throws Exception {
+
+ }
+}
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/persist_Myrpc/netty_server/src/main/java/com/zimu/server/NettyServer1.java" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/persist_Myrpc/netty_server/src/main/java/com/zimu/server/NettyServer1.java"
new file mode 100644
index 0000000000000000000000000000000000000000..fe980149f0a4c2121e77d25d605130a2be0e88d8
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/persist_Myrpc/netty_server/src/main/java/com/zimu/server/NettyServer1.java"
@@ -0,0 +1,63 @@
+package com.zimu.server;
+
+import com.zimu.handler.NettyServerHandler1;
+import com.zimu.handler.NettyServerHandler2;
+import io.netty.bootstrap.ServerBootstrap;
+import io.netty.channel.*;
+import io.netty.channel.nio.NioEventLoopGroup;
+import io.netty.channel.socket.SocketChannel;
+import io.netty.channel.socket.nio.NioServerSocketChannel;
+import io.netty.handler.timeout.IdleStateHandler;
+import org.I0Itec.zkclient.ZkClient;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.concurrent.TimeUnit;
+
+/**
+ * Netty服务端
+ * Created by 梓沐 on 2021/6/29.
+ */
+public class NettyServer1 {
+ private ZkClient zkClient;
+ public static void main(String[] args) throws InterruptedException {
+ //1. 创建bossGroup线程组: 处理网络事件--连接事件
+ EventLoopGroup bossGroup = new NioEventLoopGroup(1);
+ //2. 创建workerGroup线程组: 处理网络事件--读写事件
+ EventLoopGroup workerGroup = new NioEventLoopGroup();
+ //3. 创建服务端启动助手
+ ServerBootstrap bootstrap = new ServerBootstrap();
+ //4. 设置bossGroup线程组和workerGroup线程组
+ bootstrap.group(bossGroup,workerGroup)
+ .channel(NioServerSocketChannel.class) //5. 设置服务端通道实现为NIO
+ .option(ChannelOption.SO_BACKLOG,128) //6. 参数设置
+ .childOption(ChannelOption.SO_KEEPALIVE,Boolean.TRUE)
+ .childHandler(new ChannelInitializer() { //7. 创建一个通道初始化对象
+ @Override
+ protected void initChannel(SocketChannel socketChannel) throws Exception {
+ //8. 向pipeline中添加自定义业务处理handler
+ // 心跳检测
+ socketChannel.pipeline().addLast(new IdleStateHandler(0, 0, 9, TimeUnit.SECONDS));
+ socketChannel.pipeline().addLast(new NettyServerHandler1());
+ }
+ });
+ //9. 启动服务端并绑定端口,同时将异步改为同步
+ ChannelFuture future = bootstrap.bind(8888).sync();
+ ZkClient zkClient = new ZkClient("106.13.200.230:2182");
+ zkClient.createEphemeral("/rpc/server1",8888);
+ future.addListener(new ChannelFutureListener() {
+ @Override public void operationComplete(ChannelFuture future) throws Exception {
+ if (future.isSuccess()) {
+ System.out.println("端口绑定成功!");
+ } else {
+ System.out.println("端口绑定失败!");
+ }
+ }
+ });
+ System.out.println("Netty服务端已启动");
+ //10. 关闭通道和关闭连接池
+ future.channel().closeFuture().sync();
+ bossGroup.shutdownGracefully();
+ workerGroup.shutdownGracefully();
+ }
+}
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/persist_Myrpc/netty_server/src/main/java/com/zimu/server/NettyServer2.java" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/persist_Myrpc/netty_server/src/main/java/com/zimu/server/NettyServer2.java"
new file mode 100644
index 0000000000000000000000000000000000000000..0dad60c397878aeb28d8066864e332b40dc979f5
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/persist_Myrpc/netty_server/src/main/java/com/zimu/server/NettyServer2.java"
@@ -0,0 +1,60 @@
+package com.zimu.server;
+
+import com.zimu.handler.NettyServerHandler1;
+import com.zimu.handler.NettyServerHandler2;
+import io.netty.bootstrap.ServerBootstrap;
+import io.netty.channel.*;
+import io.netty.channel.nio.NioEventLoopGroup;
+import io.netty.channel.socket.SocketChannel;
+import io.netty.channel.socket.nio.NioServerSocketChannel;
+import io.netty.handler.timeout.IdleStateHandler;
+import org.I0Itec.zkclient.ZkClient;
+
+import java.util.concurrent.TimeUnit;
+
+/**
+ * Netty服务端
+ * Created by 梓沐 on 2021/6/29.
+ */
+public class NettyServer2 {
+ public static void main(String[] args) throws InterruptedException {
+ //1. 创建bossGroup线程组: 处理网络事件--连接事件
+ EventLoopGroup bossGroup = new NioEventLoopGroup(1);
+ //2. 创建workerGroup线程组: 处理网络事件--读写事件
+ EventLoopGroup workerGroup = new NioEventLoopGroup();
+ //3. 创建服务端启动助手
+ ServerBootstrap bootstrap = new ServerBootstrap();
+ //4. 设置bossGroup线程组和workerGroup线程组
+ bootstrap.group(bossGroup,workerGroup)
+ .channel(NioServerSocketChannel.class) //5. 设置服务端通道实现为NIO
+ .option(ChannelOption.SO_BACKLOG,128) //6. 参数设置
+ .childOption(ChannelOption.SO_KEEPALIVE,Boolean.TRUE)
+ .childHandler(new ChannelInitializer() { //7. 创建一个通道初始化对象
+ @Override
+ protected void initChannel(SocketChannel socketChannel) throws Exception {
+ //8. 向pipeline中添加自定义业务处理handler
+ // 心跳检测
+ socketChannel.pipeline().addLast(new IdleStateHandler(0, 0, 9, TimeUnit.SECONDS));
+ socketChannel.pipeline().addLast(new NettyServerHandler2());
+ }
+ });
+ //9. 启动服务端并绑定端口,同时将异步改为同步
+ ChannelFuture future = bootstrap.bind(8889).sync();
+ ZkClient zkClient = new ZkClient("106.13.200.230:2182");
+ zkClient.createEphemeral("/rpc/server2",8889);
+ future.addListener(new ChannelFutureListener() {
+ @Override public void operationComplete(ChannelFuture future) throws Exception {
+ if (future.isSuccess()) {
+ System.out.println("端口绑定成功!");
+ } else {
+ System.out.println("端口绑定失败!");
+ }
+ }
+ });
+ System.out.println("Netty服务端已启动");
+ //10. 关闭通道和关闭连接池
+ future.channel().closeFuture().sync();
+ bossGroup.shutdownGracefully();
+ workerGroup.shutdownGracefully();
+ }
+}
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/persist_Myrpc/pom.xml" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/persist_Myrpc/pom.xml"
new file mode 100644
index 0000000000000000000000000000000000000000..8ed0b9213e78d66b4a4e1f1adf57b78d2bd0f390
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/persist_Myrpc/pom.xml"
@@ -0,0 +1,71 @@
+
+
+ 4.0.0
+ pom
+
+ rpc_consumer
+ rpc_conmmon
+ netty_server
+ zookeeper_test
+ zkClient
+
+
+ org.springframework.boot
+ spring-boot-starter-parent
+ 2.5.4
+
+
+ com.zimu
+ persist_rpc
+ 0.0.1-SNAPSHOT
+ persist_rpc
+ Demo project for Spring Boot
+
+ 11
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+
+ io.netty
+ netty-all
+
+
+
+ com.alibaba
+ fastjson
+ 1.2.74
+
+
+
+ org.projectlombok
+ lombok
+ 1.18.16
+
+
+ com.101tec
+ zkclient
+ 0.2
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+
+
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/persist_Myrpc/rpc_conmmon/pom.xml" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/persist_Myrpc/rpc_conmmon/pom.xml"
new file mode 100644
index 0000000000000000000000000000000000000000..6b9991b55748d3b77c788e754280236421d4deed
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/persist_Myrpc/rpc_conmmon/pom.xml"
@@ -0,0 +1,15 @@
+
+
+
+ persist_rpc
+ com.zimu
+ 0.0.1-SNAPSHOT
+
+ 4.0.0
+
+ rpc_conmmon
+
+
+
\ No newline at end of file
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/persist_Myrpc/rpc_conmmon/src/main/java/conm/zimu/api/IUserService.java" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/persist_Myrpc/rpc_conmmon/src/main/java/conm/zimu/api/IUserService.java"
new file mode 100644
index 0000000000000000000000000000000000000000..335d735f2adb23bb35756f284d513b5f18e6edad
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/persist_Myrpc/rpc_conmmon/src/main/java/conm/zimu/api/IUserService.java"
@@ -0,0 +1,17 @@
+package conm.zimu.api;
+
+
+import conm.zimu.pojo.User;
+
+/**
+ * 用户服务
+ */
+public interface IUserService {
+ /**
+ * 根据ID查询用户
+ *
+ * @param id
+ * @return
+ */
+ User getById(int id);
+}
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/persist_Myrpc/rpc_conmmon/src/main/java/conm/zimu/conmmon/RpcRequest.java" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/persist_Myrpc/rpc_conmmon/src/main/java/conm/zimu/conmmon/RpcRequest.java"
new file mode 100644
index 0000000000000000000000000000000000000000..d6b9cc4dca3480347564198163cfb93eae21efe0
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/persist_Myrpc/rpc_conmmon/src/main/java/conm/zimu/conmmon/RpcRequest.java"
@@ -0,0 +1,34 @@
+package conm.zimu.conmmon;
+
+import lombok.Data;
+
+import java.util.Arrays;
+
+/**
+ * 封装的请求对象
+ */
+@Data
+public class RpcRequest {
+
+ /**
+ * 请求对象的ID
+ */
+ private String requestId;
+ /**
+ * 类名
+ */
+ private String className;
+ /**
+ * 方法名
+ */
+ private String methodName;
+ /**
+ * 参数类型
+ */
+ private Class>[] parameterTypes;
+ /**
+ * 入参
+ */
+ private Object[] parameters;
+
+}
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/persist_Myrpc/rpc_conmmon/src/main/java/conm/zimu/conmmon/RpcResponse.java" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/persist_Myrpc/rpc_conmmon/src/main/java/conm/zimu/conmmon/RpcResponse.java"
new file mode 100644
index 0000000000000000000000000000000000000000..cb4cbaa61098f90d9d0043588b3b7e9631afcd4e
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/persist_Myrpc/rpc_conmmon/src/main/java/conm/zimu/conmmon/RpcResponse.java"
@@ -0,0 +1,49 @@
+package conm.zimu.conmmon;
+
+import lombok.Data;
+
+/**
+ * 封装的响应对象
+ */
+@Data
+public class RpcResponse {
+
+ /**
+ * 响应ID
+ */
+ private String requestId;
+
+ /**
+ * 错误信息
+ */
+ private String error;
+
+ /**
+ * 返回的结果
+ */
+ private Object result;
+
+ public String getRequestId() {
+ return requestId;
+ }
+
+ public void setRequestId(String requestId) {
+ this.requestId = requestId;
+ }
+
+ public String getError() {
+ return error;
+ }
+
+ public void setError(String error) {
+ this.error = error;
+ }
+
+ public Object getResult() {
+ return result;
+ }
+
+ public void setResult(Object result) {
+ this.result = result;
+ }
+}
\ No newline at end of file
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/persist_Myrpc/rpc_conmmon/src/main/java/conm/zimu/pojo/User.java" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/persist_Myrpc/rpc_conmmon/src/main/java/conm/zimu/pojo/User.java"
new file mode 100644
index 0000000000000000000000000000000000000000..78feea5a928bbf217297b93693328057c889011a
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/persist_Myrpc/rpc_conmmon/src/main/java/conm/zimu/pojo/User.java"
@@ -0,0 +1,9 @@
+package conm.zimu.pojo;
+
+import lombok.Data;
+
+@Data
+public class User {
+ private int id;
+ private String name;
+}
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/persist_Myrpc/rpc_consumer/pom.xml" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/persist_Myrpc/rpc_consumer/pom.xml"
new file mode 100644
index 0000000000000000000000000000000000000000..d7394a499403a281d52b7cac6c7eb1e1edfc220d
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/persist_Myrpc/rpc_consumer/pom.xml"
@@ -0,0 +1,23 @@
+
+
+
+ persist_rpc
+ com.zimu
+ 0.0.1-SNAPSHOT
+
+ 4.0.0
+
+ rpc_consumer
+
+
+ com.zimu
+ rpc_conmmon
+ 0.0.1-SNAPSHOT
+ compile
+
+
+
+
+
\ No newline at end of file
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/persist_Myrpc/rpc_consumer/src/main/java/com/zimu/PersistRpcApplication.java" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/persist_Myrpc/rpc_consumer/src/main/java/com/zimu/PersistRpcApplication.java"
new file mode 100644
index 0000000000000000000000000000000000000000..b3f732f812bf4920bd2bb368109b170178583762
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/persist_Myrpc/rpc_consumer/src/main/java/com/zimu/PersistRpcApplication.java"
@@ -0,0 +1,18 @@
+package com.zimu;
+
+import com.zimu.proxy.RpcClientProxy;
+import com.zimu.zkClient.ZkClient;
+import conm.zimu.api.IUserService;
+import conm.zimu.pojo.User;
+import org.springframework.boot.CommandLineRunner;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class PersistRpcApplication{
+
+ public static void main(String[] args) {
+ SpringApplication.run(PersistRpcApplication.class, args);
+ ZkClient.watcher();
+ }
+}
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/persist_Myrpc/rpc_consumer/src/main/java/com/zimu/client/RpcClient.java" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/persist_Myrpc/rpc_consumer/src/main/java/com/zimu/client/RpcClient.java"
new file mode 100644
index 0000000000000000000000000000000000000000..dad21d73b1ef3b7aa0f2712d52cfacc9246dfdea
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/persist_Myrpc/rpc_consumer/src/main/java/com/zimu/client/RpcClient.java"
@@ -0,0 +1,101 @@
+package com.zimu.client;
+
+import com.zimu.handler.RpcClientHandler;
+import io.netty.bootstrap.Bootstrap;
+import io.netty.channel.*;
+import io.netty.channel.nio.NioEventLoopGroup;
+import io.netty.channel.socket.SocketChannel;
+import io.netty.channel.socket.nio.NioSocketChannel;
+import io.netty.handler.codec.string.StringDecoder;
+import io.netty.handler.codec.string.StringEncoder;
+import io.netty.handler.timeout.IdleStateHandler;
+
+import java.util.concurrent.*;
+
+/**
+ * 客户端
+ * 1.连接Netty服务端
+ * 2.提供给调用者主动关闭资源的方法
+ * 3.提供消息发送的方法
+ */
+public class RpcClient {
+
+ private EventLoopGroup group;
+
+ private Channel channel;
+
+ private String ip;
+
+ private int port;
+
+ private RpcClientHandler rpcClientHandler = new RpcClientHandler();
+
+ private ExecutorService executorService = Executors.newCachedThreadPool();
+
+ public RpcClient(String ip, int port) {
+ this.ip = ip;
+ this.port = port;
+ initClient();
+ }
+
+ /**
+ * 初始化方法-连接Netty服务端
+ */
+ public void initClient() {
+ try {
+ //1.创建线程组
+ group = new NioEventLoopGroup();
+ //2.创建启动助手
+ Bootstrap bootstrap = new Bootstrap();
+ //3.设置参数
+ bootstrap.group(group)
+ .channel(NioSocketChannel.class)
+ .option(ChannelOption.SO_KEEPALIVE, Boolean.TRUE)
+ .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 3000)
+ .handler(new ChannelInitializer() {
+ @Override
+ protected void initChannel(SocketChannel channel) throws Exception {
+ ChannelPipeline pipeline = channel.pipeline();
+ // 心跳检测
+ pipeline.addLast(new IdleStateHandler(0, 0, 3, TimeUnit.SECONDS));
+ //String类型编解码器
+ pipeline.addLast(new StringDecoder());
+ pipeline.addLast(new StringEncoder());
+ //添加客户端处理类
+ pipeline.addLast(rpcClientHandler);
+ }
+ });
+ //4.连接Netty服务端
+ channel = bootstrap.connect(ip, port).sync().channel();
+ } catch (Exception exception) {
+ exception.printStackTrace();
+ if (channel != null) {
+ channel.close();
+ }
+ if (group != null) {
+ group.shutdownGracefully();
+ }
+ }
+ }
+
+ /**
+ * 提供给调用者主动关闭资源的方法
+ */
+ public void close() {
+ if (channel != null) {
+ channel.close();
+ }
+ if (group != null) {
+ group.shutdownGracefully();
+ }
+ }
+
+ /**
+ * 提供消息发送的方法
+ */
+ public Object send(String msg) throws ExecutionException, InterruptedException {
+ rpcClientHandler.setRequestMsg(msg);
+ Future submit = executorService.submit(rpcClientHandler);
+ return submit.get();
+ }
+}
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/persist_Myrpc/rpc_consumer/src/main/java/com/zimu/controller/UserController.java" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/persist_Myrpc/rpc_consumer/src/main/java/com/zimu/controller/UserController.java"
new file mode 100644
index 0000000000000000000000000000000000000000..44e2b43d4a8e6281f126429a3d02d33fb46ca3a6
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/persist_Myrpc/rpc_consumer/src/main/java/com/zimu/controller/UserController.java"
@@ -0,0 +1,25 @@
+package com.zimu.controller;
+
+import com.zimu.proxy.RpcClientProxy;
+import conm.zimu.api.IUserService;
+import conm.zimu.pojo.User;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * Created by 梓沐 on 2021/8/22.
+ */
+@RestController
+@RequestMapping("/rpc")
+public class UserController {
+ @Autowired
+ private RpcClientProxy rpcClientProxy;
+ @RequestMapping("/getUserById")
+ public User getUserById(Integer id){
+ IUserService userService = (IUserService) rpcClientProxy.createProxy(IUserService.class);
+ System.out.println(userService.getById(1));
+ return userService.getById(1);
+ }
+}
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/persist_Myrpc/rpc_consumer/src/main/java/com/zimu/handler/RpcClientHandler.java" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/persist_Myrpc/rpc_consumer/src/main/java/com/zimu/handler/RpcClientHandler.java"
new file mode 100644
index 0000000000000000000000000000000000000000..61c8646c8a400aee7fa73c590b64064dca3ecfd1
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/persist_Myrpc/rpc_consumer/src/main/java/com/zimu/handler/RpcClientHandler.java"
@@ -0,0 +1,65 @@
+package com.zimu.handler;
+
+import io.netty.channel.ChannelHandlerContext;
+import io.netty.channel.SimpleChannelInboundHandler;
+
+import java.util.concurrent.Callable;
+
+/**
+ * 客户端处理类
+ * 1.发送消息
+ * 2.接收消息
+ */
+public class RpcClientHandler extends SimpleChannelInboundHandler implements Callable {
+
+ ChannelHandlerContext context;
+ //发送的消息
+ String requestMsg;
+
+ //服务端的消息
+ String responseMsg;
+
+ public void setRequestMsg(String requestMsg) {
+ this.requestMsg = requestMsg;
+ }
+
+ /**
+ * 通道连接就绪事件
+ *
+ * @param ctx
+ * @throws Exception
+ */
+ @Override
+ public void channelActive(ChannelHandlerContext ctx) throws Exception {
+ context = ctx;
+ }
+
+ /**
+ * 通道读取就绪事件
+ *
+ * @param channelHandlerContext
+ * @param msg
+ * @throws Exception
+ */
+ @Override
+ protected synchronized void channelRead0(ChannelHandlerContext channelHandlerContext, String msg) throws Exception {
+ responseMsg = msg;
+ //唤醒等待的线程
+ notify();
+ }
+
+ /**
+ * 发送消息到服务端
+ *
+ * @return
+ * @throws Exception
+ */
+ @Override
+ public synchronized Object call() throws Exception {
+ //消息发送
+ context.writeAndFlush(requestMsg);
+ //线程等待
+ wait();
+ return responseMsg;
+ }
+}
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/persist_Myrpc/rpc_consumer/src/main/java/com/zimu/proxy/RpcClientProxy.java" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/persist_Myrpc/rpc_consumer/src/main/java/com/zimu/proxy/RpcClientProxy.java"
new file mode 100644
index 0000000000000000000000000000000000000000..93336770b5aff1c7199cd6ebde2b550fbb4146b0
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/persist_Myrpc/rpc_consumer/src/main/java/com/zimu/proxy/RpcClientProxy.java"
@@ -0,0 +1,65 @@
+package com.zimu.proxy;
+
+import com.alibaba.fastjson.JSON;
+import com.zimu.client.RpcClient;
+import com.zimu.zkClient.ZkClient;
+import conm.zimu.conmmon.RpcRequest;
+import conm.zimu.conmmon.RpcResponse;
+import org.I0Itec.zkclient.IZkChildListener;
+import org.springframework.stereotype.Component;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.util.List;
+import java.util.UUID;
+
+
+
+
+/**
+ * 客户端代理类-创建代理对象
+ * 1.封装request请求对象
+ * 2.创建RpcClient对象
+ * 3.发送消息
+ * 4.返回结果
+ */
+@Component
+public class RpcClientProxy {
+ public static Object createProxy(Class serviceClass) {
+ return Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(),
+ new Class[]{serviceClass}, new InvocationHandler() {
+ @Override
+ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
+ //1.封装request请求对象
+ RpcRequest rpcRequest = new RpcRequest();
+ rpcRequest.setRequestId(UUID.randomUUID().toString());
+ rpcRequest.setClassName(method.getDeclaringClass().getName());
+ rpcRequest.setMethodName(method.getName());
+ rpcRequest.setParameterTypes(method.getParameterTypes());
+ rpcRequest.setParameters(args);
+ //2.创建RpcClient对象
+ for (Integer value : ZkClient.ports.values()) {
+ RpcClient rpcClient = new RpcClient("127.0.0.1", value);
+ try {
+ //3.发送消息
+ Object responseMsg = rpcClient.send(JSON.toJSONString(rpcRequest));
+ RpcResponse rpcResponse = JSON.parseObject(responseMsg.toString(), RpcResponse.class);
+ if (rpcResponse.getError() != null) {
+ throw new RuntimeException(rpcResponse.getError());
+ }
+ //4.返回结果
+ Object result = rpcResponse.getResult();
+ String name = "{name:" + result + "}";
+ return JSON.parseObject(name, method.getReturnType());
+ } catch (Exception e) {
+ throw e;
+ } finally {
+ rpcClient.close();
+ }
+ }
+ return null;
+ }
+ });
+ }
+}
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/persist_Myrpc/rpc_consumer/src/main/java/com/zimu/zkClient/ZkClient.java" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/persist_Myrpc/rpc_consumer/src/main/java/com/zimu/zkClient/ZkClient.java"
new file mode 100644
index 0000000000000000000000000000000000000000..35d76f26e2bb3b147bb54a52842f0b0274cbd989
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/persist_Myrpc/rpc_consumer/src/main/java/com/zimu/zkClient/ZkClient.java"
@@ -0,0 +1,35 @@
+package com.zimu.zkClient;
+
+import org.I0Itec.zkclient.IZkChildListener;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+/**
+ * Created by 梓沐 on 2021/8/23.
+ */
+public class ZkClient{
+ public static HashMap ports = new HashMap<>();
+ public static void watcher(){
+ org.I0Itec.zkclient.ZkClient zkClient = new org.I0Itec.zkclient.ZkClient("106.13.200.230:2182");
+ List children = zkClient.getChildren("/rpc");
+ for (String child : children) {
+ ports.put(child,Integer.valueOf(zkClient.readData("/rpc/" + child)));
+ }
+ zkClient.subscribeChildChanges("/rpc", new IZkChildListener() {
+ public void handleChildChange(String parentPath, List
+ currentChilds) throws Exception {
+ List children1 = zkClient.getChildren(parentPath);
+ if(children1.size() > 0){
+ ports.clear();
+ for (String s : children1) {
+ ports.put(s,Integer.valueOf(zkClient.readData("/rpc/" + s)));
+ }
+ }
+
+ }
+ });
+ }
+}
+
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/persist_Myrpc/rpc_consumer/src/main/resources/application.properties" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/persist_Myrpc/rpc_consumer/src/main/resources/application.properties"
new file mode 100644
index 0000000000000000000000000000000000000000..8d51d0c619c284847b0f15a0d444c7b5c3925d9a
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/persist_Myrpc/rpc_consumer/src/main/resources/application.properties"
@@ -0,0 +1 @@
+server.port=8082
\ No newline at end of file
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/persist_Myrpc/zkClient/pom.xml" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/persist_Myrpc/zkClient/pom.xml"
new file mode 100644
index 0000000000000000000000000000000000000000..88e9b2259d6de5c835aefff1d436b5ded4de9059
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/persist_Myrpc/zkClient/pom.xml"
@@ -0,0 +1,15 @@
+
+
+
+ persist_rpc
+ com.zimu
+ 0.0.1-SNAPSHOT
+
+ 4.0.0
+
+ zkClient
+
+
+
\ No newline at end of file
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/persist_Myrpc/zkClient/src/main/java/com/zimu/zkClient/ZkClientApplication.java" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/persist_Myrpc/zkClient/src/main/java/com/zimu/zkClient/ZkClientApplication.java"
new file mode 100644
index 0000000000000000000000000000000000000000..cbb4966f06eb05b139ad889944252afe10c93199
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/persist_Myrpc/zkClient/src/main/java/com/zimu/zkClient/ZkClientApplication.java"
@@ -0,0 +1,17 @@
+package com.zimu.zkClient;
+
+import org.I0Itec.zkclient.ZkClient;
+
+import java.util.List;
+
+/**
+ * Created by 梓沐 on 2021/8/23.
+ */
+public class ZkClientApplication {
+ public static void main(String[] args) {
+ ZkClient zkClient = new ZkClient("106.13.200.230:2182");
+// zkClient.createPersistent("/rpc");
+ List children = zkClient.getChildren("/rpc");
+ System.out.println(children);
+ }
+}
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/zookeeper-api/.idea/compiler.xml" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/zookeeper-api/.idea/compiler.xml"
new file mode 100644
index 0000000000000000000000000000000000000000..31a0f757f73faf2c9da45d64a9e00aebbda7ed11
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/zookeeper-api/.idea/compiler.xml"
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/zookeeper-api/.idea/encodings.xml" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/zookeeper-api/.idea/encodings.xml"
new file mode 100644
index 0000000000000000000000000000000000000000..aa00ffab7828f4818589659c804ec2cfd99baed3
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/zookeeper-api/.idea/encodings.xml"
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/zookeeper-api/.idea/misc.xml" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/zookeeper-api/.idea/misc.xml"
new file mode 100644
index 0000000000000000000000000000000000000000..32d5f87c3b608ba34a14c1ef0c3102054ce3f12e
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/zookeeper-api/.idea/misc.xml"
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/zookeeper-api/.idea/workspace.xml" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/zookeeper-api/.idea/workspace.xml"
new file mode 100644
index 0000000000000000000000000000000000000000..9b9e9e7fbf3b5394716ff9541922186b74389a3e
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/zookeeper-api/.idea/workspace.xml"
@@ -0,0 +1,127 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1628687908587
+
+
+ 1628687908587
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/zookeeper-api/pom.xml" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/zookeeper-api/pom.xml"
new file mode 100644
index 0000000000000000000000000000000000000000..161c55c523c6a08ed17ab0c2406783cd46fa4557
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/zookeeper-api/pom.xml"
@@ -0,0 +1,82 @@
+
+
+
+ 4.0.0
+
+ com.zimu
+ zookeeper-api
+ 1.0-SNAPSHOT
+ war
+
+ zookeeper-api Maven Webapp
+
+ http://www.example.com
+
+
+ UTF-8
+ 1.7
+ 1.7
+
+
+
+
+ junit
+ junit
+ 4.11
+ test
+
+
+ org.apache.zookeeper
+ zookeeper
+ 3.4.14
+
+
+ com.101tec
+ zkclient
+ 0.2
+
+
+ org.apache.curator
+ curator-framework
+ 2.12.0
+
+
+
+
+ zookeeper-api
+
+
+
+ maven-clean-plugin
+ 3.1.0
+
+
+
+ maven-resources-plugin
+ 3.0.2
+
+
+ maven-compiler-plugin
+ 3.8.0
+
+
+ maven-surefire-plugin
+ 2.22.1
+
+
+ maven-war-plugin
+ 3.2.2
+
+
+ maven-install-plugin
+ 2.5.2
+
+
+ maven-deploy-plugin
+ 2.8.2
+
+
+
+
+
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/zookeeper-api/src/main/java/com/zimu/curayor/Curator_API.java" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/zookeeper-api/src/main/java/com/zimu/curayor/Curator_API.java"
new file mode 100644
index 0000000000000000000000000000000000000000..720dfd1566b260747f1a990f0d74d9ad08223e03
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/zookeeper-api/src/main/java/com/zimu/curayor/Curator_API.java"
@@ -0,0 +1,147 @@
+package com.zimu.curayor;
+
+import org.apache.curator.RetryPolicy;
+import org.apache.curator.framework.CuratorFramework;
+import org.apache.curator.framework.CuratorFrameworkFactory;
+import org.apache.curator.retry.ExponentialBackoffRetry;
+
+/**
+ * Created by 梓沐 on 2021/8/15.
+ *
+ * curator是Netflix公司开源的⼀套Zookeeper客户端框架,和ZKClient⼀样,Curator解决了很多
+ * Zookeeper客户端⾮常底层的细节开发⼯作,包括连接重连,反复注册Watcher和
+ * NodeExistsException异常等,是最流⾏的Zookeeper客户端之⼀。从编码⻛格上来讲,它提供了基于
+ * Fluent的编程⻛格⽀持
+ */
+public class Curator_API {
+ public static void main(String[] args) {
+ /**
+ * Curator的创建会话⽅式与原⽣的API和ZkClient的创建⽅式区别很⼤。Curator创建客户端是通过
+ * CuratorFrameworkFactory⼯⼚类来实现的
+ *
+ * 使⽤CuratorFramework这个⼯⼚类的两个静态⽅法来创建⼀个客户端
+ *
+ *
+ * 其中参数RetryPolicy提供重试策略的接⼝,可以让⽤户实现⾃定义的重试策略,默认提供了以下实现,
+ * 分别为ExponentialBackoffRetry(基于backoff的重连策略)、RetryNTimes(重连N次策略)、
+ * RetryForever(永远重试策略)
+ *
+ *
+ * public static CuratorFramework newClient(String connectString, RetryPolicy retryPolicy)
+ * connectString:zk的server地址,多个server之间使⽤英⽂逗号分隔开
+ * connectionTimeoutMs:连接超时时间,如上是30s,默认是15s
+ * sessionTimeoutMs:会话超时时间,如上是50s,默认是60s
+ * retryPolicy:失败重试策略
+ *
+ * ExponentialBackoffRetry:构造器含有三个参数 ExponentialBackoffRetry(int
+ * baseSleepTimeMs, int maxRetries, int maxSleepMs)
+ * baseSleepTimeMs:初始的sleep时间,⽤于计算之后的每次重试的sleep时间,
+ * 计算公式:当前sleep时间=baseSleepTimeMs*Math.max(1,
+ * random.nextInt(1<<(retryCount+1)))
+ * maxRetries:最⼤重试次数
+ * maxSleepMs:最⼤sleep时间,如果上述的当前sleep计算出来⽐这个⼤,那么sleep⽤
+ * 这个时间,默认的最⼤时间是Integer.MAX_VALUE毫秒。
+ * 其他,查看org.apache.curator.RetryPolicy接⼝的实现类
+ * start():完成会话的创建
+ * public static CuratorFramework newClient(String connectString, int sessionTimeoutMs, int connectionTimeoutMs, RetryPolicy retryPolicy)
+ *
+ * 客户端创建之后使用start方法来启动回话
+ */
+
+ RetryPolicy retryPolicy = new ExponentialBackoffRetry(1000, 3);
+ CuratorFramework client =
+ CuratorFrameworkFactory.newClient("127.0.0.1:2181", 5000, 3000, retryPolicy);
+ client.start();
+ /**
+ * 使用fluent风格如下
+ *
+ * 需要注意的是session2会话含有隔离命名空间,即客户端对Zookeeper上数据节点的任何操作都是相
+ * 对/base⽬录进⾏的,这有利于实现不同的Zookeeper的业务之间的隔离
+ */
+// CuratorFramework client1 = CuratorFrameworkFactory.builder()
+// .connectString("127.0.0.1:2181") //server地址
+// .sessionTimeoutMs(5000) // 会话超时时间
+// .connectionTimeoutMs(3000) // 连接超时时间
+// .retryPolicy(retryPolicy) // 重试策略
+// .namespace("base") // ᇿ⽴命名空间/base
+// .build(); //
+// client1.start();
+// System.out.println("Zookeeper session2 established. ");
+
+
+ /**
+ * curator提供了⼀系列Fluent⻛格的接⼝,通过使⽤Fluent编程⻛格的接⼝,开发⼈员可以进⾏⾃由组合
+ * 来完成各种类型节点的创建。
+ */
+ /**
+ * 创建⼀个初始内容为空的节点
+ * client.create().forPath(path);
+ */
+ /**
+ * Curator默认创建的是持久节点
+ * client.create().forPath(path,"我是内容".getBytes());
+ */
+ /**
+ *
+ * creatingParentsIfNeeded这个接⼝⾮常有⽤,在使⽤ZooKeeper 的过程中,开发⼈员经常会碰到
+ * NoNodeException 异常,其中⼀个可能的原因就是试图对⼀个不存在的⽗节点创建⼦节点。因此,开
+ * 发⼈员不得不在每次创建节点之前,都判断⼀下该⽗节点是否存在——这个处理通常⽐较麻烦。在使⽤
+ * Curator 之后,通过调⽤creatingParentsIfNeeded 接⼝,Curator 就能够⾃动地递归创建所有需要的
+ * ⽗节点。
+ *
+ *
+ *
+ * 递归创建⽗节点,并选择节点类型
+ * client.create().creatingParentsIfNeeded().withMode(CreateMode.EPHEMERAL).forPa
+ * th(path);
+ */
+
+ /**
+ * 删除⼀个⼦节点
+ * client.delete().forPath(path);
+ */
+
+ /**
+ * 删除节点并递归删除其⼦节点
+ * client.delete().deletingChildrenIfNeeded().forPath(path);
+ */
+
+ /**
+ *
+ * 如果此版本已经不存在,则删除异常,异常信息如下。
+ * org.apache.zookeeper.KeeperException$BadVersionException: KeeperErrorCode = BadVersion for
+ *
+ * 指定版本进⾏删除
+ * client.delete().withVersion(1).forPath(path);
+ */
+
+ /**
+ *
+ * 只要客户端会话有效,那么Curator会在后台持续进⾏删除操作,直到节点删除成功。⽐如遇到⼀些⽹
+ * 络异常的情况,此guaranteed的强制删除就会很有效果。
+ * 强制保证删除⼀个节点
+ * client.delete().guaranteed().forPath(path);
+ */
+
+ /**
+ * 获取节点数据内容API相当简单,同时Curator提供了传⼊⼀个Stat变量的⽅式来存储服务器端返回的最
+ * 新的节点状态信息
+ *
+ * // 普通查询
+ * client.getData().forPath(path);
+ * // 包含状态查询
+ * Stat stat = new Stat();
+ * client.getData().storingStatIn(stat).forPath(path);
+ */
+
+ /**
+ * 更新数据,如果未传⼊version参数,那么更新当前最新版本,如果传⼊version则更新指定version,如
+ * 果version已经变更,则抛出异常。
+ *
+ * // 普通更新
+ * client.setData().forPath(path,"新内容".getBytes());
+ * // 指定版本更新
+ * client.setData().withVersion(1).forPath(path);
+ */
+ }
+}
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/zookeeper-api/src/main/java/com/zimu/zkClient/ZKClient_API.java" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/zookeeper-api/src/main/java/com/zimu/zkClient/ZKClient_API.java"
new file mode 100644
index 0000000000000000000000000000000000000000..db655e730206e383d5e226331c6fb4a2f307dbe9
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/zookeeper-api/src/main/java/com/zimu/zkClient/ZKClient_API.java"
@@ -0,0 +1,96 @@
+package com.zimu.zkClient;
+
+import com.zimu.zookeeper.CreateNote;
+import org.I0Itec.zkclient.IZkChildListener;
+import org.I0Itec.zkclient.IZkDataListener;
+import org.I0Itec.zkclient.ZkClient;
+
+import java.util.List;
+
+/**
+ * Created by 梓沐 on 2021/8/12.
+ * ZkClient是Github上⼀个开源的zookeeper客户端,在Zookeeper原⽣API接⼝之上进⾏了包装,是⼀个
+ * 更易⽤的Zookeeper客户端,同时,zkClient在内部还实现了诸如Session超时重连、Watcher反复注册
+ * 等功能接下来,还是从创建会话、创建节点、读取数据、更新数据、删除节点等⽅⾯来介绍如何使⽤zkClient
+ * 这个zookeeper客户端
+ */
+public class ZKClient_API {
+ public static void main(String[] args) throws InterruptedException {
+ /**
+ * 创建⼀个zkClient实例来进⾏连接
+ * 注意:zkClient通过对zookeeperAPI内部包装,将这个异步的会话创建过程同步化了
+ */
+ ZkClient zkClient = new ZkClient("106.13.200.230:2182");
+ //createParents的值设置为true,可以递归先创建父节点再创建子节点
+// zkClient.createPersistent("/zimu-persistent/zimu-c1",true);
+// //删除子节点,ZkClient可直接删除带⼦节点的⽗节点,因为其底层先删除其所有⼦节点,然后再删除⽗节点
+// zkClient.deleteRecursive("/zimu-persistent/zimu-c1");
+// //获取子节点
+// List children = zkClient.getChildren("/zimu-persistent");
+// System.out.println(children);
+//
+//// //注册监听事件
+// /**
+// * 客户端可以对⼀个不存在的节点进⾏⼦节点变更的监听。
+// * ⼀旦客户端对⼀个节点注册了⼦节点列表变更监听之后,那么当该节点的⼦节点列表发⽣变更时,服务
+// * 端都会通知客户端,并将最新的⼦节点列表发送给客户端
+// * 该节点本身的创建或删除也会通知到客户端。
+// */
+// zkClient.subscribeChildChanges("/zimu-persistent", new IZkChildListener() {
+// public void handleChildChange(String parentPath, List
+// currentChilds) throws Exception {
+// System.out.println(parentPath + " 's child changed, currentChilds:" + currentChilds);
+// }
+// });
+// zkClient.createPersistent("/zimu-persistent");
+// Thread.sleep(1000);
+// zkClient.createPersistent("/zimu-persistent/c1");
+// Thread.sleep(1000);
+// zkClient.delete("/zimu-persistent/c1");
+// Thread.sleep(1000);
+// zkClient.delete("/zimu-persistent");
+// Thread.sleep(Integer.MAX_VALUE);
+
+ //判断节点是否存在
+// boolean exists = zkClient.exists("/zimu-persistent1");
+// System.out.println(exists);
+// if (!exists){
+// zkClient.createEphemeral("/zimu-persistent1", "123");
+// } else{
+// List children = zkClient.getChildren("/zimu-persistent1");
+// System.out.println(children);
+// zkClient.delete("/zimu-persistent1/zimu-c1");
+// zkClient.createEphemeral("/zimu-persistent1", "123");
+// }
+//
+// //注册监听
+// zkClient.subscribeDataChanges("/zimu-persistent1", new IZkDataListener() {
+// public void handleDataChange(String path, Object data) throws
+// Exception {
+// System.out.println(path+"该节点内容被更新,更新后的内容"+data);
+// }
+// public void handleDataDeleted(String s) throws Exception {
+// System.out.println(s+" 该节点被删除");
+// }
+// });
+// //获取节点内容
+// Object o = zkClient.readData("/zimu-persistent1");
+// System.out.println(o);
+// //更新
+// zkClient.writeData("/zimu-persistent1","4567");
+// Thread.sleep(1000);
+// //删除
+// zkClient.delete("/zimu-persistent1");
+// Thread.sleep(1000);
+ boolean exists = zkClient.exists("/zimu-persistent");
+ System.out.println(exists);
+ if(exists){
+ List children = zkClient.getChildren("/zimu-persistent");
+ System.out.println(children);
+ boolean delete = zkClient.delete("/zimu-persistent");
+ System.out.println(delete);
+ boolean exists1 = zkClient.exists("/zimu-persistent");
+ System.out.println(exists1);
+ }
+ }
+}
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/zookeeper-api/src/main/java/com/zimu/zookeeper/CreateNote.java" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/zookeeper-api/src/main/java/com/zimu/zookeeper/CreateNote.java"
new file mode 100644
index 0000000000000000000000000000000000000000..91b1db6a3359666e282fca5cb2ab4837201f58e1
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/zookeeper-api/src/main/java/com/zimu/zookeeper/CreateNote.java"
@@ -0,0 +1,131 @@
+package com.zimu.zookeeper;
+
+import org.apache.zookeeper.*;
+import org.apache.zookeeper.data.Stat;
+
+import java.io.IOException;
+import java.util.List;
+
+/**
+ * Created by 梓沐 on 2021/8/11.
+ */
+public class CreateNote implements Watcher {
+ private static ZooKeeper zooKeeper;
+ public static void main(String[] args) throws IOException, InterruptedException {
+ /**
+ * 客户端可以通过创建⼀个zk实例来连接zk服务器
+ * new Zookeeper(connectString,sesssionTimeOut,Wather)
+ * connectString: 连接地址:IP:端⼝
+ * sesssionTimeOut:会话超时时间:单位毫秒
+ * Wather:监听器(当特定事件触发监听时,zk会通过watcher通知到客户端)
+ */
+ zooKeeper = new ZooKeeper("106.13.200.230:2182", 5000, new CreateNote());
+ /**
+ * 注意,ZooKeeper 客户端和服务端会话的建⽴是⼀个异步的过程,也就是说在程序中,构造⽅法会在处
+ * 理完客户端初始化⼯作后⽴即返回,在⼤多数情况下,此时并没有真正建⽴好⼀个可⽤的会话,在会话
+ * 的⽣命周期中处于“CONNECTING”的状态。 当该会话真正创建完毕后ZooKeeper服务端会向会话对应
+ * 的客户端发送⼀个事件通知,以告知客户端,客户端只有在获取这个通知之后,才算真正建⽴了会话。
+ */
+ System.out.println(zooKeeper.getState());
+ Thread.sleep(Integer.MAX_VALUE);
+ }
+
+ @Override
+ public void process(WatchedEvent watchedEvent) {
+ //当连接创建了,服务端发送给客户端SyncConnected事件
+ if(watchedEvent.getState() == Event.KeeperState.SyncConnected){
+ try {
+ //createNoteSync();
+// getNodeData();
+// getChildls();
+// updateNodeSync();
+ deleteNodeSync();
+ } catch (KeeperException e) {
+ e.printStackTrace();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ private void deleteNodeSync() throws KeeperException, InterruptedException
+ {
+ /**
+ * zooKeeper.exists(path,watch) :判断节点是否存在
+ * zookeeper.delete(path,version) : 删除节点
+ */
+
+ Stat exists = zooKeeper.exists("/zimu-persistent/zimu-children", false);
+ System.out.println(exists == null ? "该节点不存在":"该节点存在");
+ if(exists == null){
+ zooKeeper.create("/zimu-persistent/zimu-children", "持久性节点".getBytes(), ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
+ }
+ Stat exists1 = zooKeeper.exists("/zimu-persistent/zimu-children", false);
+ System.out.println(exists1);
+ zooKeeper.delete("/zimu-persistent/zimu-children",-1);
+ Stat exists2 = zooKeeper.exists("/zimu-persistent/zimu-children", false);
+ System.out.println(exists2 == null ? "该节点不存在":"该节点存在");
+ }
+ private void updateNodeSync() throws Exception {
+
+ /**
+ * path:路径
+ * data:要修改的内容 byte[]
+ * version:为-1,表示对最新版本的数据进⾏修改
+ * zooKeeper.setData(path, data,version);
+ */
+ byte[] data = zooKeeper.getData("/zimu-persistent", false, null);
+ System.out.println("修改前的值:"+new String(data));
+ //修改 stat:状态信息对象 -1:最新版本
+ Stat stat = zooKeeper.setData("/zimu-persistent", "客户端修改内容".getBytes(), -1);
+ System.out.println(stat);
+ byte[] data2 = zooKeeper.getData("/zimu-persistent", false, null);
+ System.out.println("修改后的值:"+new String(data2));
+ }
+ /**
+ * path:路径
+ * watch:是否要启动监听,当⼦节点列表发⽣变化,会触发监听
+ * zooKeeper.getChildren(path, watch);
+ */
+ private void getChildls() throws KeeperException, InterruptedException {
+ List children = zooKeeper.getChildren("/zimu-persistent", true);
+ System.out.println(children);
+ }
+
+ /**
+ * path : 获取数据的路径
+ * watch : 是否开启监听
+ * stat : 节点状态信息
+ * null: 表示获取最新版本的数据
+ * zk.getData(path, watch, stat);
+ */
+ private void getNodeData() throws KeeperException, InterruptedException {
+ byte[] data = zooKeeper.getData("/zimu-persistent", true, null);
+ System.out.println(new String(data));
+ }
+
+ /**
+ * path :节点创建的路径
+ * data[] :节点创建要保存的数据,是个byte类型的
+ * acl :节点创建的权限信息(4种类型)
+ * ANYONE_ID_UNSAFE : 表示任何⼈
+ * AUTH_IDS :此ID仅可⽤于设置ACL。它将被客户机验证的ID替换。
+ * OPEN_ACL_UNSAFE :这是⼀个完全开放的ACL(常⽤)-->world:anyone
+ * CREATOR_ALL_ACL :此ACL授予创建者身份验证ID的所有权限
+ * createMode :创建节点的类型(4种类型)
+ * PERSISTENT:持久节点
+ * PERSISTENT_SEQUENTIAL:持久顺序节点
+ * EPHEMERAL:临时节点
+ * EPHEMERAL_SEQUENTIAL:临时顺序节点
+ * String node = zookeeper.create(path,data,acl,createMode);
+ */
+ private void createNoteSync() throws KeeperException, InterruptedException {
+ String persistent = zooKeeper.create("/zimu-persistent", "持久性节点".getBytes(), ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
+ String ephemeral = zooKeeper.create("/zimu-ephemeral", "临时性节点".getBytes(), ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL);
+ String persistent_sequential = zooKeeper.create("/zimu-persistent_sequential", "持久性顺序节点".getBytes(), ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT_SEQUENTIAL);
+ System.out.println(persistent);
+ System.out.println(ephemeral);
+ System.out.println(persistent_sequential);
+ }
+}
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/zookeeper-api/src/main/webapp/WEB-INF/web.xml" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/zookeeper-api/src/main/webapp/WEB-INF/web.xml"
new file mode 100644
index 0000000000000000000000000000000000000000..9f88c1f9632445500e3b3688fe477b860f77d8f2
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/zookeeper-api/src/main/webapp/WEB-INF/web.xml"
@@ -0,0 +1,7 @@
+
+
+
+ Archetype Created Web Application
+
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/zookeeper-api/src/main/webapp/index.jsp" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/zookeeper-api/src/main/webapp/index.jsp"
new file mode 100644
index 0000000000000000000000000000000000000000..c38169bb958579c635a5c09ee2f379cc5956c0c2
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/zookeeper-api/src/main/webapp/index.jsp"
@@ -0,0 +1,5 @@
+
+
+Hello World!
+
+
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/zookeeper-api/target/classes/com/zimu/zkClient/ZKClient_API.class" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/zookeeper-api/target/classes/com/zimu/zkClient/ZKClient_API.class"
new file mode 100644
index 0000000000000000000000000000000000000000..beb6e5a498e3ed9edfdef35651af7984de9d89bf
Binary files /dev/null and "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/zookeeper-api/target/classes/com/zimu/zkClient/ZKClient_API.class" differ
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/zookeeper-api/target/classes/com/zimu/zookeeper/CreateNote.class" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/zookeeper-api/target/classes/com/zimu/zookeeper/CreateNote.class"
new file mode 100644
index 0000000000000000000000000000000000000000..2711b51b4a3b8ceab91ffaf9e7f75f220bba9e75
Binary files /dev/null and "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/zookeeper-api/target/classes/com/zimu/zookeeper/CreateNote.class" differ
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/zookeeper-api/zookeeper-api.iml" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/zookeeper-api/zookeeper-api.iml"
new file mode 100644
index 0000000000000000000000000000000000000000..78b2cc53b203f0b97534bb1184cdc7b474339fb4
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/code/zookeeper-api/zookeeper-api.iml"
@@ -0,0 +1,2 @@
+
+
\ No newline at end of file
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/\347\256\200\347\255\224\351\242\230/Zookeepe.pdf" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/\347\256\200\347\255\224\351\242\230/Zookeepe.pdf"
new file mode 100644
index 0000000000000000000000000000000000000000..29e7809965b79bd5bf542ba29c670d1196ccc5b9
Binary files /dev/null and "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2278\344\275\234\344\270\232)/\347\256\200\347\255\224\351\242\230/Zookeepe.pdf" differ
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/.idea/compiler.xml" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/.idea/compiler.xml"
new file mode 100644
index 0000000000000000000000000000000000000000..ddfb99604eb8102582edb23b7091feb91c591e99
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/.idea/compiler.xml"
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/.idea/misc.xml" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/.idea/misc.xml"
new file mode 100644
index 0000000000000000000000000000000000000000..d24ea8e7debb4071df92884f676aca977525fde9
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/.idea/misc.xml"
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/.idea/modules.xml" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/.idea/modules.xml"
new file mode 100644
index 0000000000000000000000000000000000000000..47136a39680b727972608371018ff2ce79bdf757
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/.idea/modules.xml"
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/.idea/uiDesigner.xml" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/.idea/uiDesigner.xml"
new file mode 100644
index 0000000000000000000000000000000000000000..e96534fb27b68192f27f985d3879e173ec77adb8
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/.idea/uiDesigner.xml"
@@ -0,0 +1,124 @@
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+
\ No newline at end of file
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/.idea/workspace.xml" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/.idea/workspace.xml"
new file mode 100644
index 0000000000000000000000000000000000000000..9b3584ae667051259e927053c11763bc3ff4c8cb
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/.idea/workspace.xml"
@@ -0,0 +1,274 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1629898415768
+
+
+ 1629898415768
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ file://$PROJECT_DIR$/dubbo-spi-router/src/main/java/com/zimu/router/RestartingInstanceRouter.java
+ 30
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/demo-dubbo-base.iml" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/demo-dubbo-base.iml"
new file mode 100644
index 0000000000000000000000000000000000000000..78b2cc53b203f0b97534bb1184cdc7b474339fb4
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/demo-dubbo-base.iml"
@@ -0,0 +1,2 @@
+
+
\ No newline at end of file
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-filter/pom.xml" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-filter/pom.xml"
new file mode 100644
index 0000000000000000000000000000000000000000..708d4322cc60307ad82218c882605a3f61da46d9
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-filter/pom.xml"
@@ -0,0 +1,19 @@
+
+
+
+ demo-dubbo-base
+ com.zimu
+ 1.0-SNAPSHOT
+
+ 4.0.0
+
+ dubbo-filter
+
+
+ org.apache.dubbo
+ dubbo
+
+
+
\ No newline at end of file
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-filter/src/main/java/com/zimu/filter/dubboSpiFilter.java" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-filter/src/main/java/com/zimu/filter/dubboSpiFilter.java"
new file mode 100644
index 0000000000000000000000000000000000000000..835fe6f5d60ebe0e0d1eb4d0694d41834b5560e7
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-filter/src/main/java/com/zimu/filter/dubboSpiFilter.java"
@@ -0,0 +1,22 @@
+package com.zimu.filter;
+
+import org.apache.dubbo.common.constants.CommonConstants;
+import org.apache.dubbo.common.extension.Activate;
+import org.apache.dubbo.rpc.*;
+
+/**
+ * Created by 梓沐 on 2021/8/30.
+ */
+@Activate(group = {CommonConstants.PROVIDER,CommonConstants.CONSUMER})
+public class dubboSpiFilter implements Filter {
+ @Override
+ public Result invoke(Invoker> invoker, Invocation invocation) throws RpcException {
+ Long startTime = System.currentTimeMillis();
+ try{
+ return invoker.invoke(invocation);
+ }finally {
+ long time = System.currentTimeMillis() - startTime;
+ System.out.println("执行时间为:" + time + "毫秒");
+ }
+ }
+}
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-filter/src/main/resources/META-INF/dubbo/org.apache.dubbo.rpc.Filter" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-filter/src/main/resources/META-INF/dubbo/org.apache.dubbo.rpc.Filter"
new file mode 100644
index 0000000000000000000000000000000000000000..9dabfec82e407a3d6a290dae40cbb0add352365e
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-filter/src/main/resources/META-INF/dubbo/org.apache.dubbo.rpc.Filter"
@@ -0,0 +1 @@
+timeFilter=com.zimu.filter.dubboSpiFilter
\ No newline at end of file
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-filter/target/classes/META-INF/dubbo/org.apache.dubbo.rpc.Filter" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-filter/target/classes/META-INF/dubbo/org.apache.dubbo.rpc.Filter"
new file mode 100644
index 0000000000000000000000000000000000000000..9dabfec82e407a3d6a290dae40cbb0add352365e
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-filter/target/classes/META-INF/dubbo/org.apache.dubbo.rpc.Filter"
@@ -0,0 +1 @@
+timeFilter=com.zimu.filter.dubboSpiFilter
\ No newline at end of file
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-filter/target/classes/com/zimu/filter/dubboSpiFilter.class" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-filter/target/classes/com/zimu/filter/dubboSpiFilter.class"
new file mode 100644
index 0000000000000000000000000000000000000000..aae641c24a5cd735004b68a94fea7ff501cc4710
Binary files /dev/null and "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-filter/target/classes/com/zimu/filter/dubboSpiFilter.class" differ
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-loadBalance/pom.xml" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-loadBalance/pom.xml"
new file mode 100644
index 0000000000000000000000000000000000000000..057870821ce32846f200894ed68133c9a1635851
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-loadBalance/pom.xml"
@@ -0,0 +1,20 @@
+
+
+
+ demo-dubbo-base
+ com.zimu
+ 1.0-SNAPSHOT
+
+ 4.0.0
+
+ dubbo-loadBalance
+
+
+ org.apache.dubbo
+ dubbo
+
+
+
+
\ No newline at end of file
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-loadBalance/src/main/java/com/zimu/loadbalance/DubboSpiLoadBalance.java" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-loadBalance/src/main/java/com/zimu/loadbalance/DubboSpiLoadBalance.java"
new file mode 100644
index 0000000000000000000000000000000000000000..99d3f657556fc29b26b2c22d22e5a5ddb3668c29
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-loadBalance/src/main/java/com/zimu/loadbalance/DubboSpiLoadBalance.java"
@@ -0,0 +1,25 @@
+package com.zimu.loadbalance;
+
+import org.apache.dubbo.common.URL;
+import org.apache.dubbo.rpc.Invocation;
+import org.apache.dubbo.rpc.Invoker;
+import org.apache.dubbo.rpc.RpcException;
+import org.apache.dubbo.rpc.cluster.LoadBalance;
+
+import java.util.List;
+
+/**
+ * Created by 梓沐 on 2021/8/30.
+ */
+public class DubboSpiLoadBalance implements LoadBalance {
+ @Override
+ public Invoker select(List> invokers, URL url, Invocation invocation) throws RpcException {
+ return invokers.stream().sorted((i1,i2)->{
+ final int ipCompare = i1.getUrl().getIp().compareTo(i2.getUrl().getIp());
+ if(ipCompare == 0){
+ return Integer.compare(i1.getUrl().getPort(),i2.getUrl().getPort());
+ }
+ return ipCompare;
+ }).findFirst().get();
+ }
+}
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-loadBalance/src/main/resources/META-INF/dubbo/org.apache.dubbo.rpc.cluster.LoadBalance" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-loadBalance/src/main/resources/META-INF/dubbo/org.apache.dubbo.rpc.cluster.LoadBalance"
new file mode 100644
index 0000000000000000000000000000000000000000..cc2afe3a926a3328e67426ee0a8eb0f23881608d
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-loadBalance/src/main/resources/META-INF/dubbo/org.apache.dubbo.rpc.cluster.LoadBalance"
@@ -0,0 +1 @@
+onlyFirst=com.zimu.loadbalance.DubboSpiLoadBalance
\ No newline at end of file
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-loadBalance/target/classes/META-INF/dubbo/org.apache.dubbo.rpc.cluster.LoadBalance" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-loadBalance/target/classes/META-INF/dubbo/org.apache.dubbo.rpc.cluster.LoadBalance"
new file mode 100644
index 0000000000000000000000000000000000000000..cc2afe3a926a3328e67426ee0a8eb0f23881608d
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-loadBalance/target/classes/META-INF/dubbo/org.apache.dubbo.rpc.cluster.LoadBalance"
@@ -0,0 +1 @@
+onlyFirst=com.zimu.loadbalance.DubboSpiLoadBalance
\ No newline at end of file
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-loadBalance/target/classes/com/zimu/loadbalance/DubboSpiLoadBalance.class" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-loadBalance/target/classes/com/zimu/loadbalance/DubboSpiLoadBalance.class"
new file mode 100644
index 0000000000000000000000000000000000000000..6ff9a8aed02c74cd60ab1ae92b08c4ae54c0f5a8
Binary files /dev/null and "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-loadBalance/target/classes/com/zimu/loadbalance/DubboSpiLoadBalance.class" differ
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-spi-router/pom.xml" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-spi-router/pom.xml"
new file mode 100644
index 0000000000000000000000000000000000000000..efd327a981ac2a42c59279312f0b68d45f89858d
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-spi-router/pom.xml"
@@ -0,0 +1,25 @@
+
+
+
+ demo-dubbo-base
+ com.zimu
+ 1.0-SNAPSHOT
+
+ 4.0.0
+
+ dubbo-spi-router
+
+
+ org.apache.dubbo
+ dubbo
+
+
+ org.apache.curator
+ curator-recipes
+ 4.2.0
+
+
+
+
\ No newline at end of file
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-spi-router/src/main/java/com/zimu/router/DubboRouterMain.java" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-spi-router/src/main/java/com/zimu/router/DubboRouterMain.java"
new file mode 100644
index 0000000000000000000000000000000000000000..e0362f787bfc547973c3aacc049a41177a15bc32
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-spi-router/src/main/java/com/zimu/router/DubboRouterMain.java"
@@ -0,0 +1,10 @@
+package com.zimu.router;
+
+/**
+ * Created by 梓沐 on 2021/9/1.
+ */
+public class DubboRouterMain {
+ public static void main(String[] args) {
+ ReadyRestartInstances.create().addRestartInstance("service-provider","127.0.0.1");
+ }
+}
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-spi-router/src/main/java/com/zimu/router/ReadyRestartInstances.java" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-spi-router/src/main/java/com/zimu/router/ReadyRestartInstances.java"
new file mode 100644
index 0000000000000000000000000000000000000000..da9c1388d59923884343ee2b34e46d21c7a33baf
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-spi-router/src/main/java/com/zimu/router/ReadyRestartInstances.java"
@@ -0,0 +1,92 @@
+package com.zimu.router;
+
+import org.apache.curator.framework.CuratorFramework;
+import org.apache.curator.framework.recipes.cache.PathChildrenCache;
+import org.apache.curator.framework.recipes.cache.PathChildrenCacheEvent;
+import org.apache.curator.framework.recipes.cache.PathChildrenCacheListener;
+import org.apache.zookeeper.data.Stat;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.util.CollectionUtils;
+
+import java.util.*;
+
+/**
+ * Created by 梓沐 on 2021/9/1.
+ */
+public class ReadyRestartInstances implements PathChildrenCacheListener {
+ private static final Logger LOGGER = LoggerFactory.getLogger(ReadyRestartInstances.class);
+ //重启或者关闭的提供者服务节点所在的根路径
+ private static final String LISTEN_PATH = "/dubbo/restart/instances";
+ private CuratorFramework zkClient;
+ //当节点变化时,给这个名单赋值,重启或者关闭的提供者服务名单
+ private Set restartInstances = new HashSet<>();
+ //获取zookeeper操作对象
+ private ReadyRestartInstances(CuratorFramework zkClient) {
+ this.zkClient = zkClient;
+ }
+ //获取ReadyRestartInstances对象
+ public static ReadyRestartInstances create(){
+ CuratorFramework client = ZookeeperClients.client();
+ try {
+ //检查监听路径是否存在
+ Stat stat = client.checkExists().forPath(LISTEN_PATH);
+ //如果监听路径不存在,就创建监听路径
+ if(stat == null){
+ client.create().creatingParentsIfNeeded().forPath(LISTEN_PATH);
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ LOGGER.error("监听路径有毒");
+ }
+ //创建重启或者关闭的提供者服务名单实例
+ ReadyRestartInstances readyRestartInstances = new ReadyRestartInstances(client);
+ //创建一个缓存节点
+ PathChildrenCache cacheNode = new PathChildrenCache(client, LISTEN_PATH, false);
+ //给缓存关系节点加入监听
+ cacheNode.getListenable().addListener(readyRestartInstances);
+ try {
+ cacheNode.start();
+ } catch (Exception e) {
+ e.printStackTrace();
+ LOGGER.error("缓存节点有毒");
+ }
+ return readyRestartInstances;
+ }
+ //获取应用名和主机名拼接的字符串
+ private String buildApplicationAndHostString(String application,String host){
+ return application + "-" +host;
+ }
+ //在名单中增加重启或者关闭服务的方法
+ public void addRestartInstance(String application,String host){
+ try {
+ zkClient.create().creatingParentsIfNeeded().forPath(LISTEN_PATH + "/" +buildApplicationAndHostString(application,host));
+ } catch (Exception e) {
+ e.printStackTrace();
+ LOGGER.error("增加方法有毒");
+ }
+ }
+ //在名单中删除重启或者关闭服务的方法
+ public void removeRestartInstance(String application,String host){
+ try {
+ zkClient.delete().forPath(LISTEN_PATH + "/" +buildApplicationAndHostString(application,host));
+ } catch (Exception e) {
+ e.printStackTrace();
+ LOGGER.error("删除方法有毒");
+ }
+ }
+ //在名单中判断重启或者关闭的服务是否存在
+ public boolean hasExist(String application, String host){
+ return restartInstances.contains(buildApplicationAndHostString(application,host));
+ }
+ @Override
+ public void childEvent(CuratorFramework curatorFramework, PathChildrenCacheEvent pathChildrenCacheEvent) throws Exception {
+ //查询出监听目录下,所有目录的配置信息
+ List restartingInstances = zkClient.getChildren().forPath(LISTEN_PATH);
+ if(CollectionUtils.isEmpty(restartingInstances)){
+ this.restartInstances = Collections.EMPTY_SET;
+ }else {
+ this.restartInstances = new HashSet<>(restartingInstances);
+ }
+ }
+}
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-spi-router/src/main/java/com/zimu/router/RestartingInstanceRouter.java" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-spi-router/src/main/java/com/zimu/router/RestartingInstanceRouter.java"
new file mode 100644
index 0000000000000000000000000000000000000000..2aed10a6e16bc3db4f8a46b9bb7a7e414e831d36
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-spi-router/src/main/java/com/zimu/router/RestartingInstanceRouter.java"
@@ -0,0 +1,48 @@
+package com.zimu.router;
+
+import org.apache.dubbo.common.URL;
+import org.apache.dubbo.rpc.Invocation;
+import org.apache.dubbo.rpc.Invoker;
+import org.apache.dubbo.rpc.RpcException;
+import org.apache.dubbo.rpc.cluster.Router;
+
+import java.util.List;
+import java.util.stream.Collectors;
+//编写路由类(实现 org.apache.dubbo.rpc.cluster.Router ),主要目的在于对
+//ReadyRestartInstances 中的数据进行处理,并且移除路由调用列表中正在重启中的服务。
+public class RestartingInstanceRouter implements Router {
+ private final ReadyRestartInstances instances;
+ private final URL url;
+
+ public RestartingInstanceRouter(URL url) {
+ this.url = url;
+ this.instances = ReadyRestartInstances.create();
+ }
+
+ @Override
+ public URL getUrl() {
+ return url;
+ }
+
+ @Override
+ public List> route(List> invokers, URL url, Invocation invocation) throws RpcException {
+
+ // 如果没有在重启列表中 才会加入到后续调用列表
+ return invokers.stream().filter(i->!instances.hasExist(i.getUrl().getParameter("remote.application"),i.getUrl().getIp()))
+ .collect(Collectors.toList());
+}
+ @Override
+ public boolean isRuntime() {
+ return false;
+ }
+
+ @Override
+ public boolean isForce() {
+ return true;
+ }
+
+ @Override
+ public int getPriority() {
+ return 0;
+ }
+}
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-spi-router/src/main/java/com/zimu/router/RestartingInstanceRouterFactory.java" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-spi-router/src/main/java/com/zimu/router/RestartingInstanceRouterFactory.java"
new file mode 100644
index 0000000000000000000000000000000000000000..805452d91cb587ddd0efd222f1ea922ec5c5a0ff
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-spi-router/src/main/java/com/zimu/router/RestartingInstanceRouterFactory.java"
@@ -0,0 +1,14 @@
+package com.zimu.router;
+
+import org.apache.dubbo.common.URL;
+import org.apache.dubbo.common.extension.Activate;
+import org.apache.dubbo.rpc.cluster.Router;
+import org.apache.dubbo.rpc.cluster.RouterFactory;
+
+@Activate
+public class RestartingInstanceRouterFactory implements RouterFactory {
+ @Override
+ public Router getRouter(URL url) {
+ return new RestartingInstanceRouter(url);
+ }
+}
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-spi-router/src/main/java/com/zimu/router/ZookeeperClients.java" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-spi-router/src/main/java/com/zimu/router/ZookeeperClients.java"
new file mode 100644
index 0000000000000000000000000000000000000000..f1206b8123795ea19f09799ad98e87c42037f576
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-spi-router/src/main/java/com/zimu/router/ZookeeperClients.java"
@@ -0,0 +1,29 @@
+package com.zimu.router;
+
+import org.apache.curator.RetryPolicy;
+import org.apache.curator.framework.CuratorFramework;
+import org.apache.curator.framework.CuratorFrameworkFactory;
+import org.apache.curator.retry.ExponentialBackoffRetry;
+import org.springframework.util.backoff.ExponentialBackOff;
+
+/**
+ * Created by 梓沐 on 2021/9/1.
+ * zookeeper工具类
+ */
+public class ZookeeperClients {
+ private final CuratorFramework client;
+ private static ZookeeperClients zookeeperClients;
+
+ private ZookeeperClients(CuratorFramework client) {
+ this.client = client;
+ }
+ static {
+ RetryPolicy retry = new ExponentialBackoffRetry(1000, 3);
+ CuratorFramework client = CuratorFrameworkFactory.newClient("106.13.200.230:2182", retry);
+ zookeeperClients = new ZookeeperClients(client);
+ client.start();
+ }
+ public static CuratorFramework client(){
+ return zookeeperClients.client;
+ }
+}
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-spi-router/src/main/resources/META-INF/dubbo/org.apache.dubbo.rpc.cluster.RouterFactory" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-spi-router/src/main/resources/META-INF/dubbo/org.apache.dubbo.rpc.cluster.RouterFactory"
new file mode 100644
index 0000000000000000000000000000000000000000..e569a885ed888b62be5f02ad61392fb2f5cae1a7
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-spi-router/src/main/resources/META-INF/dubbo/org.apache.dubbo.rpc.cluster.RouterFactory"
@@ -0,0 +1 @@
+com.lagou.router.RestartingInstanceRouterFactory
\ No newline at end of file
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-spi-router/src/main/resources/log4j.properties" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-spi-router/src/main/resources/log4j.properties"
new file mode 100644
index 0000000000000000000000000000000000000000..1ab09eb645b4c0d84855921181d9e413ccc76779
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-spi-router/src/main/resources/log4j.properties"
@@ -0,0 +1,5 @@
+log4j.rootCategory=INFO,CONSOLE
+
+log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
+log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
+log4j.appender.CONSOLE.layout.ConversionPattern=%d{HH:mm:ss.SSS} [%t] %-5p %c.%M\(%F:%L\) - %m%n
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-spi-router/target/classes/META-INF/dubbo/org.apache.dubbo.rpc.cluster.RouterFactory" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-spi-router/target/classes/META-INF/dubbo/org.apache.dubbo.rpc.cluster.RouterFactory"
new file mode 100644
index 0000000000000000000000000000000000000000..e569a885ed888b62be5f02ad61392fb2f5cae1a7
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-spi-router/target/classes/META-INF/dubbo/org.apache.dubbo.rpc.cluster.RouterFactory"
@@ -0,0 +1 @@
+com.lagou.router.RestartingInstanceRouterFactory
\ No newline at end of file
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-spi-router/target/classes/com/zimu/router/DubboRouterMain.class" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-spi-router/target/classes/com/zimu/router/DubboRouterMain.class"
new file mode 100644
index 0000000000000000000000000000000000000000..474818cd50aa7f10eff614f6db0aad578b55e2b3
Binary files /dev/null and "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-spi-router/target/classes/com/zimu/router/DubboRouterMain.class" differ
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-spi-router/target/classes/com/zimu/router/ReadyRestartInstances.class" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-spi-router/target/classes/com/zimu/router/ReadyRestartInstances.class"
new file mode 100644
index 0000000000000000000000000000000000000000..2ee06f8e7a94b7af7fa7f50fca5b2e7c25d3d3ae
Binary files /dev/null and "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-spi-router/target/classes/com/zimu/router/ReadyRestartInstances.class" differ
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-spi-router/target/classes/com/zimu/router/RestartingInstanceRouter.class" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-spi-router/target/classes/com/zimu/router/RestartingInstanceRouter.class"
new file mode 100644
index 0000000000000000000000000000000000000000..0ca0dfbd2cfe6ff764a5759726a0af26c9b915e5
Binary files /dev/null and "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-spi-router/target/classes/com/zimu/router/RestartingInstanceRouter.class" differ
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-spi-router/target/classes/com/zimu/router/RestartingInstanceRouterFactory.class" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-spi-router/target/classes/com/zimu/router/RestartingInstanceRouterFactory.class"
new file mode 100644
index 0000000000000000000000000000000000000000..fabbb803548e1a3c6409ffe9b42b7947f3758bbe
Binary files /dev/null and "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-spi-router/target/classes/com/zimu/router/RestartingInstanceRouterFactory.class" differ
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-spi-router/target/classes/com/zimu/router/ZookeeperClients.class" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-spi-router/target/classes/com/zimu/router/ZookeeperClients.class"
new file mode 100644
index 0000000000000000000000000000000000000000..42ddd090c7538ac2207340d013ead58c22c9521f
Binary files /dev/null and "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-spi-router/target/classes/com/zimu/router/ZookeeperClients.class" differ
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-spi-router/target/classes/log4j.properties" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-spi-router/target/classes/log4j.properties"
new file mode 100644
index 0000000000000000000000000000000000000000..1ab09eb645b4c0d84855921181d9e413ccc76779
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-spi-router/target/classes/log4j.properties"
@@ -0,0 +1,5 @@
+log4j.rootCategory=INFO,CONSOLE
+
+log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
+log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
+log4j.appender.CONSOLE.layout.ConversionPattern=%d{HH:mm:ss.SSS} [%t] %-5p %c.%M\(%F:%L\) - %m%n
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-spi-threadpool/dubbo-spi-threadpool.iml" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-spi-threadpool/dubbo-spi-threadpool.iml"
new file mode 100644
index 0000000000000000000000000000000000000000..d246e8a265fd2b6a5fb1df6e65fdfc363d3ba3b1
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-spi-threadpool/dubbo-spi-threadpool.iml"
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-spi-threadpool/pom.xml" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-spi-threadpool/pom.xml"
new file mode 100644
index 0000000000000000000000000000000000000000..4d0871832606dcb21a4dec065a09d3607a5b8e1c
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-spi-threadpool/pom.xml"
@@ -0,0 +1,24 @@
+
+
+
+ demo-dubbo-base
+ com.zimu
+ 1.0-SNAPSHOT
+
+ 4.0.0
+
+ dubbo-spi-threadpool
+
+
+ org.apache.dubbo
+ dubbo-common
+
+
+ org.apache.dubbo
+ dubbo
+
+
+
+
\ No newline at end of file
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-spi-threadpool/src/main/java/com/zimu/thread/WatchingThreadPool.java" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-spi-threadpool/src/main/java/com/zimu/thread/WatchingThreadPool.java"
new file mode 100644
index 0000000000000000000000000000000000000000..776ac25981699033cd1b841475e464b47e15ccf7
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-spi-threadpool/src/main/java/com/zimu/thread/WatchingThreadPool.java"
@@ -0,0 +1,54 @@
+package com.zimu.thread;
+
+import org.apache.dubbo.common.URL;
+import org.apache.dubbo.common.threadpool.support.fixed.FixedThreadPool;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.*;
+
+/**
+ * Created by 梓沐 on 2021/8/31.
+ */
+public class WatchingThreadPool extends FixedThreadPool implements Runnable{
+ private static final Logger LOGGER = LoggerFactory.getLogger(WatchingThreadPool.class);
+ //定义线程池使用的阈值
+ private static final double ALARM_PERCENT = 0.90;
+ private final Map THREAD_POOLS = new ConcurrentHashMap<>();
+ public WatchingThreadPool(){
+ //每隔3秒打印线程使用情况
+ Executors.newSingleThreadScheduledExecutor().scheduleWithFixedDelay(this,1,3, TimeUnit.SECONDS);
+ }
+
+ @Override
+ public Executor getExecutor(URL url) {
+ //从父类中创建线程池
+ final Executor executor = super.getExecutor(url);
+ if(executor instanceof ThreadPoolExecutor){
+ THREAD_POOLS.put(url, (ThreadPoolExecutor) executor);
+ }
+ return executor;
+ }
+
+ @Override
+ public void run() {
+ // 遍历线程池,如果超出指定的部分,进行操作,比如接入公司的告警系统或者短信平台
+ for (Map.Entry entry : THREAD_POOLS.entrySet()) {
+ URL url = entry.getKey();
+ ThreadPoolExecutor executor = entry.getValue();
+ //当前执行中的线程数
+ int activeCount = executor.getActiveCount();
+ //总的线程数
+ int corePoolSize = executor.getCorePoolSize();
+ //现成使用率
+ double persent = activeCount / corePoolSize;
+ LOGGER.info("线程执行状态:[{}/{}={}%]",activeCount,corePoolSize,persent*100);
+ if(persent>ALARM_PERCENT){
+ LOGGER.info("超出警戒线!host:{},使用率:{}%,url:{}",url.getIp(),persent*100,url);
+ }
+ }
+ }
+}
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-spi-threadpool/src/main/resources/META-INF/dubbo/org.apache.dubbo.common.threadpool.ThreadPool" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-spi-threadpool/src/main/resources/META-INF/dubbo/org.apache.dubbo.common.threadpool.ThreadPool"
new file mode 100644
index 0000000000000000000000000000000000000000..459bbf90638ffef9d0c42057bd340a04717da591
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-spi-threadpool/src/main/resources/META-INF/dubbo/org.apache.dubbo.common.threadpool.ThreadPool"
@@ -0,0 +1 @@
+watching=com.zimu.thread.WatchingThreadPool
\ No newline at end of file
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-spi-threadpool/target/classes/META-INF/dubbo/org.apache.dubbo.common.threadpool.ThreadPool" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-spi-threadpool/target/classes/META-INF/dubbo/org.apache.dubbo.common.threadpool.ThreadPool"
new file mode 100644
index 0000000000000000000000000000000000000000..459bbf90638ffef9d0c42057bd340a04717da591
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-spi-threadpool/target/classes/META-INF/dubbo/org.apache.dubbo.common.threadpool.ThreadPool"
@@ -0,0 +1 @@
+watching=com.zimu.thread.WatchingThreadPool
\ No newline at end of file
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-spi-threadpool/target/classes/com/zimu/thread/WatchingThreadPool.class" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-spi-threadpool/target/classes/com/zimu/thread/WatchingThreadPool.class"
new file mode 100644
index 0000000000000000000000000000000000000000..6979d840f3d0d3ee6849e6179570304bcba2bad7
Binary files /dev/null and "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/dubbo-spi-threadpool/target/classes/com/zimu/thread/WatchingThreadPool.class" differ
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/pom.xml" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/pom.xml"
new file mode 100644
index 0000000000000000000000000000000000000000..7b6a8c6043bdf055860b08bdcfb8fe4506016b13
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/pom.xml"
@@ -0,0 +1,103 @@
+
+
+ 4.0.0
+
+ com.zimu
+ demo-dubbo-base
+ pom
+ 1.0-SNAPSHOT
+
+ service-api
+ service-provider
+ service-consumer
+ dubbo-filter
+ dubbo-loadBalance
+ dubbo-spi-threadpoo;
+ dubbo-spi-router
+
+
+
+ 2.7.5
+
+
+
+
+
+ org.apache.dubbo
+ dubbo
+ ${dubbo.version}
+
+
+ org.apache.dubbo
+ dubbo-common
+ ${dubbo.version}
+
+
+ org.apache.dubbo
+ dubbo-registry-zookeeper
+ ${dubbo.version}
+
+
+ org.apache.dubbo
+ dubbo-registry-nacos
+ ${dubbo.version}
+
+
+ org.apache.dubbo
+ dubbo-rpc-dubbo
+ ${dubbo.version}
+
+
+ org.apache.dubbo
+ dubbo-remoting-netty4
+ ${dubbo.version}
+
+
+ org.apache.dubbo
+ dubbo-serialization-hessian2
+ ${dubbo.version}
+
+
+
+
+
+
+
+ log4j
+ log4j
+ 1.2.16
+
+
+ org.slf4j
+ slf4j-api
+ 1.7.5
+
+
+ org.slf4j
+ slf4j-log4j12
+ 1.7.5
+
+
+
+
+ com.alibaba
+ fastjson
+ 1.2.62
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.3
+
+ 11
+ 11
+
+
+
+
+
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/service-api/pom.xml" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/service-api/pom.xml"
new file mode 100644
index 0000000000000000000000000000000000000000..0d48832cdeebfa88190e460ec71f6b621c8352c5
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/service-api/pom.xml"
@@ -0,0 +1,20 @@
+
+
+
+ demo-dubbo-base
+ com.zimu
+ 1.0-SNAPSHOT
+
+ 4.0.0
+
+ service-api
+
+
+
+ org.apache.dubbo
+ dubbo
+
+
+
\ No newline at end of file
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/service-api/src/main/java/com/zimu/server/IUserService.java" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/service-api/src/main/java/com/zimu/server/IUserService.java"
new file mode 100644
index 0000000000000000000000000000000000000000..9325acea8955d48cd88f86b2ab7ae4ea28b244b9
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/service-api/src/main/java/com/zimu/server/IUserService.java"
@@ -0,0 +1,6 @@
+package com.zimu.server;
+
+public interface IUserService {
+ String getName();
+ String getName(Integer timeOut);
+}
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/service-api/target/classes/com/zimu/server/IUserService.class" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/service-api/target/classes/com/zimu/server/IUserService.class"
new file mode 100644
index 0000000000000000000000000000000000000000..db1f3c6d9ccd4f5accd5771dd851a95442c2bdba
Binary files /dev/null and "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/service-api/target/classes/com/zimu/server/IUserService.class" differ
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/service-consumer/pom.xml" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/service-consumer/pom.xml"
new file mode 100644
index 0000000000000000000000000000000000000000..69696fc22b8599568e3b2455d1d5f7224c932306
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/service-consumer/pom.xml"
@@ -0,0 +1,52 @@
+
+
+
+ demo-dubbo-base
+ com.zimu
+ 1.0-SNAPSHOT
+
+ 4.0.0
+
+ service-consumer
+
+
+ com.zimu
+ service-api
+ 1.0-SNAPSHOT
+ compile
+
+
+ org.apache.dubbo
+ dubbo
+
+
+ org.apache.dubbo
+ dubbo-registry-zookeeper
+
+
+ org.apache.dubbo
+ dubbo-rpc-dubbo
+
+
+ org.apache.dubbo
+ dubbo-remoting-netty4
+
+
+ org.apache.dubbo
+ dubbo-serialization-hessian2
+
+
+
+
+
+
+
+ com.zimu
+ dubbo-loadBalance
+ 1.0-SNAPSHOT
+
+
+
+
\ No newline at end of file
diff --git "a/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/service-consumer/src/main/java/com/zimu/DubboAsyncConsumerMain.java" "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/service-consumer/src/main/java/com/zimu/DubboAsyncConsumerMain.java"
new file mode 100644
index 0000000000000000000000000000000000000000..479d55b4180ff07dd512e9e0a6652e097e0eaae2
--- /dev/null
+++ "b/\346\235\216\345\255\237\345\235\244I(\346\250\241\345\235\2279\344\275\234\344\270\232)/code/demo-dubbo-base/service-consumer/src/main/java/com/zimu/DubboAsyncConsumerMain.java"
@@ -0,0 +1,48 @@
+package com.zimu;
+
+import com.zimu.component.UserServiceComponent;
+import com.zimu.server.IUserService;
+import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
+import org.apache.dubbo.rpc.RpcContext;
+import org.springframework.context.annotation.AnnotationConfigApplicationContext;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.PropertySource;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+import java.io.IOException;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+
+/**
+ * Created by 梓沐 on 2021/8/25.
+ */
+public class DubboAsyncConsumerMain {
+ public static void main(String[] args) throws IOException {
+ ClassPathXmlApplicationContext app = new ClassPathXmlApplicationContext("consumer.xml");
+ IUserService userService = app.getBean(IUserService.class);
+
+ while (true){
+ System.in.read();
+ String name = userService.getName(3000);
+ System.out.println(name);
+ Future