|
@@ -21,7 +21,14 @@ import java.util.*;
|
|
|
public class MergeUtils {
|
|
|
public static final Logger LOGGER = LoggerFactory.getLogger(MergeUtils.class);
|
|
|
|
|
|
+ // mergeConfFile_topQueueName 对应的 StrategyQueue 缓存
|
|
|
+ private static final Map<String, StrategyQueue> topQueueMap = new HashMap<>();
|
|
|
+
|
|
|
public static StrategyQueue createTopQueue(String mergeConfFile, String topQueueName) {
|
|
|
+ String key = mergeConfFile + "_" + topQueueName;
|
|
|
+ if (topQueueMap.containsKey(key)) {
|
|
|
+ return topQueueMap.get(key);
|
|
|
+ }
|
|
|
StrategyQueueConfig strategyQueueConfig = new StrategyQueueConfig();
|
|
|
Config mergeQueueConf = ConfigFactory.parseResources(mergeConfFile);
|
|
|
if (strategyQueueConfig.load(mergeQueueConf)) {
|
|
@@ -44,6 +51,7 @@ public class MergeUtils {
|
|
|
} catch (InvocationTargetException e) {
|
|
|
LOGGER.error("construct top StrategyQueue: [{}]", e);
|
|
|
}
|
|
|
+ topQueueMap.put(key, topQueue);
|
|
|
return topQueue;
|
|
|
}
|
|
|
|