codelipenghui commented on a change in pull request #9802:
URL: https://github.com/apache/pulsar/pull/9802#discussion_r596734204



##########
File path: 
pulsar-client/src/main/java/org/apache/pulsar/client/impl/PulsarClientImpl.java
##########
@@ -152,7 +167,12 @@ public PulsarClientImpl(ClientConfigurationData conf, 
EventLoopGroup eventLoopGr
         } else {
             lookup = new BinaryProtoLookupService(this, conf.getServiceUrl(), 
conf.getListenerName(), conf.isUseTls(), 
externalExecutorProvider.getExecutor());
         }
-        timer = new HashedWheelTimer(getThreadFactory("pulsar-timer"), 1, 
TimeUnit.MILLISECONDS);
+        if (timer == null) {
+            this.timer = new 
HashedWheelTimer(getThreadFactory("pulsar-timer"), 1, TimeUnit.MILLISECONDS);
+            needStopTimer = true;
+        } else {
+            this.timer = timer;
+        }

Review comment:
       @linlinnn Could you please add the test back? I noticed you have removed 
the unit test, it's better to cover it here to make sure the timer can be 
closed if the timer is not a external timer.




----------------------------------------------------------------
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.

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


Reply via email to