@@ -114,30 +114,19 @@ public void updateSubscription(ClientInfo clientInfo, String consumerGroup,
114
114
if (CollectionUtils .isEmpty (groupTopicClients )) {
115
115
log .error ("group {} topic {} clients is empty" , consumerGroup , subscription );
116
116
}
117
+ ConsumerGroupConf consumerGroupConf = localConsumerGroupMapping .computeIfAbsent (consumerGroup , (consumerGroupInner ) ->
118
+ new ConsumerGroupConf (consumerGroup )
119
+ );
117
120
118
- ConsumerGroupConf consumerGroupConf = localConsumerGroupMapping .get (consumerGroup );
119
- if (consumerGroupConf == null ) {
120
- // new subscription
121
- ConsumerGroupConf prev = localConsumerGroupMapping .putIfAbsent (consumerGroup , new ConsumerGroupConf (consumerGroup ));
122
- if (prev == null ) {
123
- log .info ("add new subscription, consumer group: {}" , consumerGroup );
124
- }
125
- consumerGroupConf = localConsumerGroupMapping .get (consumerGroup );
126
- }
127
-
128
- ConsumerGroupTopicConf consumerGroupTopicConf = consumerGroupConf .getConsumerGroupTopicConf ()
129
- .get (subscription .getTopic ());
130
- if (consumerGroupTopicConf == null ) {
131
- consumerGroupConf .getConsumerGroupTopicConf ().computeIfAbsent (subscription .getTopic (), (topic ) -> {
121
+ ConsumerGroupTopicConf consumerGroupTopicConf =
122
+ consumerGroupConf .getConsumerGroupTopicConf ().computeIfAbsent (subscription .getTopic (), (topicInner ) -> {
132
123
ConsumerGroupTopicConf newTopicConf = new ConsumerGroupTopicConf ();
133
124
newTopicConf .setConsumerGroup (consumerGroup );
134
- newTopicConf .setTopic (topic );
125
+ newTopicConf .setTopic (topicInner );
135
126
newTopicConf .setSubscriptionItem (subscription );
136
127
log .info ("add new {}" , newTopicConf );
137
128
return newTopicConf ;
138
129
});
139
- consumerGroupTopicConf = consumerGroupConf .getConsumerGroupTopicConf ().get (subscription .getTopic ());
140
- }
141
130
142
131
consumerGroupTopicConf .getUrls ().add (url );
143
132
if (!consumerGroupTopicConf .getIdcUrls ().containsKey (clientInfo .getIdc ())) {
0 commit comments