()
| 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)); |
no test coverage detected