neuyilan commented on a change in pull request #2635:
URL: https://github.com/apache/iotdb/pull/2635#discussion_r571512990



##########
File path: 
cluster/src/main/java/org/apache/iotdb/cluster/metadata/CMManager.java
##########
@@ -623,13 +648,16 @@ public void setCoordinator(Coordinator coordinator) {
           result = SyncClientAdaptor
               .getUnregisteredMeasurements(client, partitionGroup.getHeader(), 
seriesList);
         } else {
-          SyncDataClient syncDataClient =
-              metaGroupMember.getClientProvider().getSyncDataClient(node,
-                  RaftServer.getReadOperationTimeoutMS());
-          result = 
syncDataClient.getUnregisteredTimeseries(partitionGroup.getHeader(), 
seriesList);
-          ClientUtils.putBackSyncClient(syncDataClient);
+          SyncDataClient syncDataClient = null;
+          try {
+            syncDataClient = 
metaGroupMember.getClientProvider().getSyncDataClient(node,
+                RaftServer.getReadOperationTimeoutMS());
+            result = syncDataClient
+                .getUnregisteredTimeseries(partitionGroup.getHeader(), 
seriesList);
+          } finally {
+            ClientUtils.putBackSyncClient(syncDataClient);

Review comment:
       null client value can not be put back to the client pool, this is 
guaranteed in function putBackSyncClient in ClientUtils,
   if the client is null, the two if in the judgment condition is not tenable, 
so it will not be put back.




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