File tree Expand file tree Collapse file tree
broker/src/main/java/org/apache/rocketmq/broker/client Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2222import java .util .Iterator ;
2323import java .util .List ;
2424import java .util .Map .Entry ;
25+ import java .util .Optional ;
2526import java .util .Set ;
2627import java .util .concurrent .ConcurrentHashMap ;
2728import java .util .concurrent .ConcurrentMap ;
@@ -386,11 +387,7 @@ public void scanNotActiveChannel() {
386387 }
387388
388389 public HashSet <String > queryTopicConsumeByWho (final String topic ) {
389- HashSet <String > groups = new HashSet <>();
390- if (this .topicGroupTable .get (topic ) != null ) {
391- groups .addAll (this .topicGroupTable .get (topic ));
392- }
393- return groups ;
390+ return new HashSet <>(Optional .ofNullable (topicGroupTable .get (topic )).orElseGet (HashSet ::new ));
394391 }
395392
396393 public void appendConsumerIdsChangeListener (ConsumerIdsChangeListener listener ) {
You can’t perform that action at this time.
0 commit comments