AE86 3 months ago
parent
commit
2b6b35046b

+ 6 - 9
dbsyncer-manager/src/main/java/org/dbsyncer/manager/impl/FullPuller.java

@@ -63,12 +63,9 @@ public final class FullPuller extends AbstractPuller implements ApplicationListe
             final String metaId = mapping.getMetaId();
             ExecutorService executor = Executors.newFixedThreadPool(mapping.getThreadNum());
             try {
-                map.computeIfAbsent(metaId, k -> {
-                    logger.info("开始全量同步:{}, {}", metaId, mapping.getName());
-                    Task task = new Task(metaId);
-                    doTask(task, mapping, list, executor);
-                    return task;
-                });
+                Task task = map.computeIfAbsent(metaId, k -> new Task(metaId));
+                logger.info("开始全量同步:{}, {}", metaId, mapping.getName());
+                doTask(task, mapping, list, executor);
             } catch (Exception e) {
                 logger.error(e.getMessage(), e);
                 logService.log(LogType.SystemLog.ERROR, e.getMessage());
@@ -90,10 +87,10 @@ public final class FullPuller extends AbstractPuller implements ApplicationListe
 
     @Override
     public void close(String metaId) {
-        Task task = map.get(metaId);
-        if (null != task) {
+        map.computeIfPresent(metaId, (k, task) -> {
             task.stop();
-        }
+            return null;
+        });
     }
 
     @Override

+ 0 - 9
dbsyncer-parser/src/main/java/org/dbsyncer/parser/enums/MetaEnum.java

@@ -32,15 +32,6 @@ public enum MetaEnum {
         this.message = message;
     }
 
-    public static MetaEnum getMetaEnum(int code) throws ParserException {
-        for (MetaEnum e : MetaEnum.values()) {
-            if (code == e.getCode()) {
-                return e;
-            }
-        }
-        throw new ParserException(String.format("Meta code \"%s\" does not exist.", code));
-    }
-
     public static boolean isRunning(int state) {
         return RUNNING.getCode() == state || STOPPING.getCode() == state;
     }