From 6274208525b7e80c208f614915ef973d63834101 Mon Sep 17 00:00:00 2001
From: duxinglangzi <871364441@qq.com>
Date: 星期六, 23 四月 2022 20:52:14 +0800
Subject: [PATCH] 修改部分注释内容

---
 src/main/java/com/duxinglangzi/canal/starter/configuration/CanalAutoConfigurationProperties.java         |    2 
 src/main/java/com/duxinglangzi/canal/starter/container/DmlMessageTransponderContainer.java               |    2 
 src/main/java/com/duxinglangzi/canal/starter/factory/TransponderContainerFactory.java                    |   10 ++++
 src/main/java/com/duxinglangzi/canal/starter/configuration/CanalListenerAnnotationBeanPostProcessor.java |    5 +-
 src/main/java/com/duxinglangzi/canal/starter/container/AbstractCanalTransponderContainer.java            |    5 +-
 src/main/java/com/duxinglangzi/canal/starter/configuration/CanalConfigurationSelector.java               |    7 +++
 src/main/java/com/duxinglangzi/canal/starter/configuration/CanalListenerEndpointRegistrar.java           |   18 ++++++++
 src/main/java/com/duxinglangzi/canal/starter/configuration/CanalBootstrapConfiguration.java              |    8 +++
 src/main/java/com/duxinglangzi/canal/starter/factory/CanalConnectorFactory.java                          |    7 +++
 README.md                                                                                                |    2 
 src/main/java/com/duxinglangzi/canal/starter/listener/ApplicationReadyListener.java                      |    2 
 11 files changed, 56 insertions(+), 12 deletions(-)

diff --git a/README.md b/README.md
index d1afc37..866e73b 100644
--- a/README.md
+++ b/README.md
@@ -38,7 +38,7 @@
 public class CanalListenerTest {
 
     /**
-     * 鐩墠 Listener 鏂规硶鐨勫弬鏁板繀椤讳负 CanalEntry.EventType eventType, CanalEntry.RowData rowData
+     * 鐩墠 Listener 鏂规硶鐨勫弬鏁板繀椤讳负 CanalEntry.EventType , CanalEntry.RowData 
      * 绋嬪簭鍦ㄥ惎鍔ㄨ繃绋嬩腑浼氬仛妫�鏌�
      */
 
diff --git a/src/main/java/com/duxinglangzi/canal/starter/configuration/CanalAutoConfigurationProperties.java b/src/main/java/com/duxinglangzi/canal/starter/configuration/CanalAutoConfigurationProperties.java
index 6b71090..430dd22 100644
--- a/src/main/java/com/duxinglangzi/canal/starter/configuration/CanalAutoConfigurationProperties.java
+++ b/src/main/java/com/duxinglangzi/canal/starter/configuration/CanalAutoConfigurationProperties.java
@@ -8,8 +8,8 @@
 import java.util.Map;
 
 /**
+ * Canal杩炴帴鐨勯厤缃被
  * @author wuqiong 2022/4/11
- * @description
  */
 @Order(Ordered.HIGHEST_PRECEDENCE)
 @ConfigurationProperties(prefix = "spring.canal")
diff --git a/src/main/java/com/duxinglangzi/canal/starter/configuration/CanalBootstrapConfiguration.java b/src/main/java/com/duxinglangzi/canal/starter/configuration/CanalBootstrapConfiguration.java
index 00a5bf2..f6f4bbb 100644
--- a/src/main/java/com/duxinglangzi/canal/starter/configuration/CanalBootstrapConfiguration.java
+++ b/src/main/java/com/duxinglangzi/canal/starter/configuration/CanalBootstrapConfiguration.java
@@ -7,13 +7,19 @@
 
 /**
  * @author wuqiong 2022/4/12
- * @description
  */
 public class CanalBootstrapConfiguration implements ImportBeanDefinitionRegistrar {
 
     public static final String CANAL_LISTENER_ANNOTATION_PROCESSOR_BEAN_NAME =
             "com.duxinglangzi.canal.starter.configuration.CanalListenerAnnotationBeanPostProcessor";
 
+    /**
+     * 娉ㄥ唽 CanalListenerAnnotationBeanPostProcessor 鍒皊pring bean 瀹瑰櫒鍐�
+     * @param importingClassMetadata
+     * @param registry
+     * @return void
+     * @author wuqiong 2022-04-23 20:21
+     */
     @Override
     public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) {
         if (!registry.containsBeanDefinition(CANAL_LISTENER_ANNOTATION_PROCESSOR_BEAN_NAME)) {
diff --git a/src/main/java/com/duxinglangzi/canal/starter/configuration/CanalConfigurationSelector.java b/src/main/java/com/duxinglangzi/canal/starter/configuration/CanalConfigurationSelector.java
index e4150fc..a6adcd1 100644
--- a/src/main/java/com/duxinglangzi/canal/starter/configuration/CanalConfigurationSelector.java
+++ b/src/main/java/com/duxinglangzi/canal/starter/configuration/CanalConfigurationSelector.java
@@ -5,10 +5,15 @@
 
 /**
  * @author wuqiong 2022/4/12
- * @description
  */
 public class CanalConfigurationSelector implements DeferredImportSelector {
 
+    /**
+     * 鎵弿鍣� 瀵煎叆鎸囧畾绫伙紝 杩欓噷瀵煎叆 CanalBootstrapConfiguration.class
+     * @param importingClassMetadata
+     * @return java.lang.String[]
+     * @author wuqiong 2022-04-23 20:20
+     */
     @Override
     public String[] selectImports(AnnotationMetadata importingClassMetadata) {
         return new String[]{CanalBootstrapConfiguration.class.getName()};
diff --git a/src/main/java/com/duxinglangzi/canal/starter/configuration/CanalListenerAnnotationBeanPostProcessor.java b/src/main/java/com/duxinglangzi/canal/starter/configuration/CanalListenerAnnotationBeanPostProcessor.java
index 617c73e..02d401e 100644
--- a/src/main/java/com/duxinglangzi/canal/starter/configuration/CanalListenerAnnotationBeanPostProcessor.java
+++ b/src/main/java/com/duxinglangzi/canal/starter/configuration/CanalListenerAnnotationBeanPostProcessor.java
@@ -23,7 +23,6 @@
 
 /**
  * @author wuqiong 2022/4/11
- * @description
  */
 public class CanalListenerAnnotationBeanPostProcessor implements
         BeanPostProcessor, SmartInitializingSingleton, BeanFactoryPostProcessor {
@@ -39,15 +38,17 @@
     public Object postProcessAfterInitialization(final Object bean, final String beanName) throws BeansException {
         if (notAnnotatedClasses.contains(bean.getClass())) return bean;
         Class<?> targetClass = AopUtils.getTargetClass(bean);
+        // 鍙壂鎻忕被鐨勬柟娉曪紝鐩墠 CanalListener 鍙敮鎸佸湪鏂规硶涓�
         Map<Method, CanalListener> annotatedMethods = MethodIntrospector.selectMethods(targetClass,
                 (MethodIntrospector.MetadataLookup<CanalListener>) method -> findListenerAnnotations(method));
         if (annotatedMethods.isEmpty()) {
             this.notAnnotatedClasses.add(bean.getClass());
         } else {
+            // 鍏堝姞鍏ュ埌寰呮敞鍐岄噷闈�
             annotatedMethods.entrySet().stream()
                     .filter(e -> e != null)
                     .forEach(ele -> registrars.add(new CanalListenerEndpointRegistrar(bean, ele)));
-            logger.info("Registered @CanalListener methods processed on bean:{} , Methods :{} ", bean.getClass().getName(),
+            logger.info("Registered @CanalListener methods processed on bean:{} , Methods :{} ", beanName,
                     annotatedMethods.keySet().stream().map(e -> e.getName()).collect(Collectors.toSet()));
         }
         return bean;
diff --git a/src/main/java/com/duxinglangzi/canal/starter/configuration/CanalListenerEndpointRegistrar.java b/src/main/java/com/duxinglangzi/canal/starter/configuration/CanalListenerEndpointRegistrar.java
index 0b19476..e1a4d8a 100644
--- a/src/main/java/com/duxinglangzi/canal/starter/configuration/CanalListenerEndpointRegistrar.java
+++ b/src/main/java/com/duxinglangzi/canal/starter/configuration/CanalListenerEndpointRegistrar.java
@@ -14,14 +14,22 @@
 import java.util.stream.Collectors;
 
 /**
+ * 鐧昏鍛�
  * @author wuqiong 2022/4/11
- * @description
  */
 public class CanalListenerEndpointRegistrar {
 
     private Object bean;
     private Map.Entry<Method, CanalListener> listenerEntry;
 
+    /**
+     * 1銆佺洰鍓嶅疄鐜扮殑 DML 瑙f瀽鍣ㄤ粎鏀寔涓や釜鍙傛暟 <p>
+     * 2銆佷笖椤哄簭蹇呴』涓�: CanalEntry.EventType 銆� CanalEntry.RowData  <p>
+     * 3銆佸鏋淐analListener 鎸囧畾鐨� destination 涓嶅湪閰嶇疆鏂囦欢鍐咃紝鍒欑洿鎺ユ姏閿� <p>
+     * @param sets
+     * @return void
+     * @author wuqiong 2022-04-23 20:27
+     */
     public void checkParameter(Set<String> sets) {
         List<Class<?>> classes = parameterTypes();
         if (classes.size() > 2
@@ -45,6 +53,14 @@
         return getListenerEntry().getValue().destination().equals(destination);
     }
 
+    /**
+     * 杩囨护鍙傛暟
+     * @param database
+     * @param tableName
+     * @param eventType
+     * @return java.util.function.Predicate
+     * @author wuqiong 2022-04-23 20:47
+     */
     public static Predicate<CanalListenerEndpointRegistrar> filterArgs(
             String database, String tableName, CanalEntry.EventType eventType) {
         Predicate<CanalListenerEndpointRegistrar> databases = e -> StringUtils.isBlank(e.getListenerEntry().getValue().database())
diff --git a/src/main/java/com/duxinglangzi/canal/starter/container/AbstractCanalTransponderContainer.java b/src/main/java/com/duxinglangzi/canal/starter/container/AbstractCanalTransponderContainer.java
index 95007e7..bd0e919 100644
--- a/src/main/java/com/duxinglangzi/canal/starter/container/AbstractCanalTransponderContainer.java
+++ b/src/main/java/com/duxinglangzi/canal/starter/container/AbstractCanalTransponderContainer.java
@@ -9,8 +9,8 @@
 import java.util.concurrent.TimeUnit;
 
 /**
+ * 鎶借薄鐨刢anal transponder ,瀹炵幇SmartLifecycle鎺ュ彛,澹版槑鍛ㄦ湡鐢眘pring杩涜绠$悊
  * @author wuqiong 2022/4/11
- * @description
  */
 public abstract class AbstractCanalTransponderContainer implements SmartLifecycle {
     protected boolean isRunning = false;
@@ -26,13 +26,14 @@
 
     @Override
     public void start() {
-        setRunning(true);
         new Thread(() -> {
+            // spring 鍚姩鍚� 鎵嶄細杩涜canal鏁版嵁鎷夊彇
             while (!ApplicationReadyListener.START_LISTENER_CONTAINER.get())
                 sleep(5L * SLEEP_TIME_MILLI_SECONDS);
             initConnect();
             while (isRunning() && !Thread.currentThread().isInterrupted()) doStart();
         }).start();
+        setRunning(true);
     }
 
     @Override
diff --git a/src/main/java/com/duxinglangzi/canal/starter/container/DmlMessageTransponderContainer.java b/src/main/java/com/duxinglangzi/canal/starter/container/DmlMessageTransponderContainer.java
index dd426aa..d554cad 100644
--- a/src/main/java/com/duxinglangzi/canal/starter/container/DmlMessageTransponderContainer.java
+++ b/src/main/java/com/duxinglangzi/canal/starter/container/DmlMessageTransponderContainer.java
@@ -12,8 +12,8 @@
 import java.util.*;
 
 /**
+ * DML 鏁版嵁鎷夊彇銆佽В鏋�
  * @author wuqiong 2022/4/11
- * @description
  */
 public class DmlMessageTransponderContainer extends AbstractCanalTransponderContainer {
 
diff --git a/src/main/java/com/duxinglangzi/canal/starter/factory/CanalConnectorFactory.java b/src/main/java/com/duxinglangzi/canal/starter/factory/CanalConnectorFactory.java
index 68f63da..d1ed7cd 100644
--- a/src/main/java/com/duxinglangzi/canal/starter/factory/CanalConnectorFactory.java
+++ b/src/main/java/com/duxinglangzi/canal/starter/factory/CanalConnectorFactory.java
@@ -15,6 +15,13 @@
 
 public class CanalConnectorFactory {
 
+    /**
+     * 鍒涘缓 CanalConnector
+     * @param destination
+     * @param endpointInstance
+     * @return CanalConnector
+     * @author wuqiong 2022-04-23 20:36
+     */
     public static synchronized CanalConnector createConnector(
             String destination, CanalAutoConfigurationProperties.EndpointInstance endpointInstance) {
         Assert.isTrue(StringUtils.hasText(destination), "destination is null , please check ");
diff --git a/src/main/java/com/duxinglangzi/canal/starter/factory/TransponderContainerFactory.java b/src/main/java/com/duxinglangzi/canal/starter/factory/TransponderContainerFactory.java
index bec75d0..e050ab2 100644
--- a/src/main/java/com/duxinglangzi/canal/starter/factory/TransponderContainerFactory.java
+++ b/src/main/java/com/duxinglangzi/canal/starter/factory/TransponderContainerFactory.java
@@ -20,6 +20,14 @@
     private static final String CONTAINER_ID_PREFIX = "com.duxinglangzi.canal.starter.container.MessageTransponderContainer#";
 
 
+    /**
+     * 灏嗘墍鏈夊緟娉ㄥ唽鐨勭鐐癸紝娉ㄥ唽鍒皊pring涓�
+     * @param beanFactory
+     * @param canalConfig
+     * @param registrars
+     * @return void
+     * @author wuqiong 2022-04-23 20:34
+     */
     public static void registerListenerContainer(
             ConfigurableListableBeanFactory beanFactory, CanalAutoConfigurationProperties canalConfig,
             Set<CanalListenerEndpointRegistrar> registrars) {
@@ -30,8 +38,8 @@
             if (beanFactory.containsBean(getContainerID(endpointInstance.getKey()))) continue; // 濡傛灉宸茬粡瀛樺湪鍒欎笉鍦ㄥ垱寤�
             List<CanalListenerEndpointRegistrar> registrarList = new ArrayList<>();
             for (CanalListenerEndpointRegistrar registrar : registrars) {
-                if (!registrar.isContainDestination(endpointInstance.getKey())) continue;
                 registrar.checkParameter(canalConfig.getInstances().keySet());
+                if (!registrar.isContainDestination(endpointInstance.getKey())) continue;
                 registrarList.add(registrar);
             }
             if (registrarList.isEmpty()) continue;
diff --git a/src/main/java/com/duxinglangzi/canal/starter/listener/ApplicationReadyListener.java b/src/main/java/com/duxinglangzi/canal/starter/listener/ApplicationReadyListener.java
index 36cbd24..b6d7498 100644
--- a/src/main/java/com/duxinglangzi/canal/starter/listener/ApplicationReadyListener.java
+++ b/src/main/java/com/duxinglangzi/canal/starter/listener/ApplicationReadyListener.java
@@ -7,7 +7,6 @@
 
 /**
  * @author wuqiong 2022/4/16
- * @description
  */
 public class ApplicationReadyListener implements ApplicationListener<ApplicationReadyEvent>{
 
@@ -15,6 +14,7 @@
 
     @Override
     public void onApplicationEvent(ApplicationReadyEvent event) {
+        // 纭繚绋嬪簭鍚姩涔嬪悗锛屽啀鏀捐鎵�鏈夌殑 canal transponder
         if (!START_LISTENER_CONTAINER.get()) START_LISTENER_CONTAINER.set(true);
     }
 }

--
Gitblit v1.8.0