mirror of
https://github.com/alibaba/canal.git
synced 2026-11-04 00:30:15 +08:00
* 解决OutAdapter单例导致的问题,如 1.多个es7 outAdapter的多线程问题(共享同一个es bulk request),2.多个es7 outAdapter共用一份es配置问题 * 1. 优化adapter和监听器之间的代码结构 2. 监听器只处理匹配的配置文件 3. bugfix-es adapter配置文件回调时漏写esVersion 理论上一个adapter实例对应一个config配置文件 Co-authored-by: agapple <jianghang.loujh@alibaba-inc.com>
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
package com.alibaba.otter.canal.client.adapter.support;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* Created by @author zhuchao on @date 2021/11/11.
|
||||
*/
|
||||
public class FileName2KeyMapping {
|
||||
|
||||
private static Map<String, String> MAP = new ConcurrentHashMap<>();
|
||||
|
||||
public static void register(String type, String fileName, String key) {
|
||||
MAP.putIfAbsent(join(type, fileName), key);
|
||||
}
|
||||
|
||||
public static void unregister(String type, String fileName) {
|
||||
MAP.remove(join(type, fileName));
|
||||
}
|
||||
|
||||
public static String getKey(String type, String fileName) {
|
||||
return MAP.get(join(type, fileName));
|
||||
}
|
||||
|
||||
private static String join(String type, String fileName) {
|
||||
return type + "|" + fileName;
|
||||
}
|
||||
}
|
||||
@@ -30,6 +30,8 @@ public class Util {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(Util.class);
|
||||
|
||||
public static final String AUTO_GENERATED_PREFIX = "AUTO_GENERATED_";
|
||||
|
||||
/**
|
||||
* 通过DS执行sql
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user