wardlican commented on a change in pull request #2186:
URL: https://github.com/apache/incubator-inlong/pull/2186#discussion_r788337767



##########
File path: 
inlong-sdk/sort-sdk/src/main/java/org/apache/inlong/sdk/sort/impl/InLongTopicManagerImpl.java
##########
@@ -69,26 +76,25 @@ private void updateToBeSelectFetchers(Collection<String> c) 
{
 
     @Override
     public InLongTopicFetcher addFetcher(InLongTopic inLongTopic) {
+
         try {
             InLongTopicFetcher result = 
fetchers.get(inLongTopic.getTopicKey());
             if (result == null) {
-                InLongTopicFetcher inLongTopicFetcher = new 
InLongPulsarFetcherImpl(inLongTopic, context);
+                // create fetcher (pulsar,tube,kafka)
+                InLongTopicFetcher inLongTopicFetcher = 
createInLongTopicFetcher(inLongTopic);
                 InLongTopicFetcher preValue = 
fetchers.putIfAbsent(inLongTopic.getTopicKey(), inLongTopicFetcher);
                 logger.info("addFetcher :{}", inLongTopic.getTopicKey());
                 if (preValue != null) {
                     result = preValue;
-                    inLongTopicFetcher.close();
+                    if (inLongTopicFetcher != null) {
+                        inLongTopicFetcher.close();

Review comment:
       This implementation effect is the same, and there is no optimization 
effect




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to