@@ -293,11 +293,7 @@ public TopicConfig createTopicInSendMessageMethod(final String topic, final Stri
293293 }
294294
295295 if (createNew ) {
296- if (brokerController .getBrokerConfig ().isEnableSingleTopicRegister ()) {
297- this .brokerController .registerSingleTopicAll (topicConfig );
298- } else {
299- this .brokerController .registerIncrementBrokerData (topicConfig , dataVersion );
300- }
296+ registerBrokerData (topicConfig );
301297 }
302298
303299 return topicConfig ;
@@ -337,11 +333,7 @@ public TopicConfig createTopicIfAbsent(TopicConfig topicConfig, boolean register
337333 log .error ("createTopicIfAbsent " , e );
338334 }
339335 if (createNew && register ) {
340- if (brokerController .getBrokerConfig ().isEnableSingleTopicRegister ()) {
341- this .brokerController .registerSingleTopicAll (topicConfig );
342- } else {
343- this .brokerController .registerIncrementBrokerData (topicConfig , dataVersion );
344- }
336+ registerBrokerData (topicConfig );
345337 }
346338 return getTopicConfig (topicConfig .getTopicName ());
347339 }
@@ -401,11 +393,7 @@ public TopicConfig createTopicInSendMessageBackMethod(
401393 }
402394
403395 if (createNew ) {
404- if (brokerController .getBrokerConfig ().isEnableSingleTopicRegister ()) {
405- this .brokerController .registerSingleTopicAll (topicConfig );
406- } else {
407- this .brokerController .registerIncrementBrokerData (topicConfig , dataVersion );
408- }
396+ registerBrokerData (topicConfig );
409397 }
410398
411399 return topicConfig ;
@@ -446,11 +434,7 @@ public TopicConfig createTopicOfTranCheckMaxTime(final int clientDefaultTopicQue
446434 }
447435
448436 if (createNew ) {
449- if (brokerController .getBrokerConfig ().isEnableSingleTopicRegister ()) {
450- this .brokerController .registerSingleTopicAll (topicConfig );
451- } else {
452- this .brokerController .registerIncrementBrokerData (topicConfig , dataVersion );
453- }
437+ registerBrokerData (topicConfig );
454438 }
455439
456440 return topicConfig ;
@@ -476,11 +460,7 @@ public void updateTopicUnitFlag(final String topic, final boolean unit) {
476460 dataVersion .nextVersion (stateMachineVersion );
477461
478462 this .persist ();
479- if (brokerController .getBrokerConfig ().isEnableSingleTopicRegister ()) {
480- this .brokerController .registerSingleTopicAll (topicConfig );
481- } else {
482- this .brokerController .registerIncrementBrokerData (topicConfig , dataVersion );
483- }
463+ registerBrokerData (topicConfig );
484464 }
485465 }
486466
@@ -503,11 +483,7 @@ public void updateTopicUnitSubFlag(final String topic, final boolean hasUnitSub)
503483 dataVersion .nextVersion (stateMachineVersion );
504484
505485 this .persist ();
506- if (brokerController .getBrokerConfig ().isEnableSingleTopicRegister ()) {
507- this .brokerController .registerSingleTopicAll (topicConfig );
508- } else {
509- this .brokerController .registerIncrementBrokerData (topicConfig , dataVersion );
510- }
486+ registerBrokerData (topicConfig );
511487 }
512488 }
513489
@@ -699,6 +675,14 @@ private Map<String, String> current(String topic) {
699675 }
700676 }
701677
678+ private void registerBrokerData (TopicConfig topicConfig ) {
679+ if (brokerController .getBrokerConfig ().isEnableSingleTopicRegister ()) {
680+ this .brokerController .registerSingleTopicAll (topicConfig );
681+ } else {
682+ this .brokerController .registerIncrementBrokerData (topicConfig , dataVersion );
683+ }
684+ }
685+
702686 public boolean containsTopic (String topic ) {
703687 return topicConfigTable .containsKey (topic );
704688 }
0 commit comments