You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2021/05/31 07:33:19 UTC

[GitHub] [ozone] adoroszlai commented on a change in pull request #2289: HDDS-5280. Make XceiverClientManager creation when necessary in ContainerOperationClient

adoroszlai commented on a change in pull request #2289:
URL: https://github.com/apache/ozone/pull/2289#discussion_r642233854



##########
File path: hadoop-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/ContainerOperationClient.java
##########
@@ -131,7 +135,7 @@ public ContainerWithPipeline createContainer(String owner)
               allocateContainer(replicationType, replicationFactor, owner);
 
       Pipeline pipeline = containerWithPipeline.getPipeline();
-      client = xceiverClientManager.acquireClient(pipeline);
+      client = getXceiverClientManager().acquireClient(pipeline);

Review comment:
       Nit: please store `XceiverClientManager` and use the reference for `releaseClient`.  (Also in other methods.)

##########
File path: hadoop-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/ContainerOperationClient.java
##########
@@ -69,16 +69,20 @@
   private final StorageContainerLocationProtocol
       storageContainerLocationClient;
   private final boolean containerTokenEnabled;
+  private final OzoneConfiguration configuration;
+  private XceiverClientManager xceiverClientManager;
 
-  public XceiverClientManager getXceiverClientManager() {
+  public synchronized XceiverClientManager getXceiverClientManager()
+      throws IOException {
+    if (this.xceiverClientManager == null) {
+      this.xceiverClientManager = newXCeiverClientManager(configuration);
+    }
     return xceiverClientManager;
   }
 
-  private final XceiverClientManager xceiverClientManager;
-
   public ContainerOperationClient(OzoneConfiguration conf) throws IOException {

Review comment:
       The constructor no longer throws `IOException`.
   
   ```suggestion
     public ContainerOperationClient(OzoneConfiguration conf) {
   ```
   
   It will need corresponding changes in places where `ContainerOperationClient` is created.




-- 
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org