MCPcopy Create free account
hub / github.com/e2wugui/zeze / loadMQ

Method loadMQ

ZezeJava/ZezeJava/src/main/java/Zeze/MQ/MQManager.java:102–124  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

100 }
101
102 private void loadMQ() throws IOException {
103 var topics = new File(home).listFiles();
104 if (null == topics)
105 return ;
106
107 for (var topic : topics) {
108 if (topic.isDirectory()) {
109 var partitions = topic.listFiles();
110 if (null == partitions)
111 continue;
112 var partitionIndexes = new HashSet<Integer>();
113 for (var partition : partitions) {
114 if (partition.isFile()) {
115 // 相同分区的文件可能有多个,这里使用HashSet会去重。
116 var pa = partition.getName().split("\\.");
117 if (pa.length == 2)
118 partitionIndexes.add(Integer.parseInt(pa[0]));
119 }
120 }
121 createPartition(topic.getName(), partitionIndexes);
122 }
123 }
124 }
125
126 private void createPartition(String topic, HashSet<Integer> partitionIndexes) {
127 var cp = queues.computeIfAbsent(topic, (key) -> new MQPartition(this));

Callers 1

startMethod · 0.95

Calls 4

createPartitionMethod · 0.95
parseIntMethod · 0.80
getNameMethod · 0.65
addMethod · 0.65

Tested by

no test coverage detected