This is an automated email from the ASF dual-hosted git repository.

adoroszlai pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git


The following commit(s) were added to refs/heads/master by this push:
     new 9b6c142b85 HDDS-10874. Create non-caching XceiverClientFactory 
implementation (#7044)
9b6c142b85 is described below

commit 9b6c142b85875355fa5ab942d42a0ffc6790daf4
Author: Doroszlai, Attila <[email protected]>
AuthorDate: Thu Aug 8 10:55:01 2024 +0200

    HDDS-10874. Create non-caching XceiverClientFactory implementation (#7044)
---
 .../hadoop/hdds/scm/XceiverClientCreator.java      | 117 +++++++++++++++++++++
 .../hadoop/hdds/scm/XceiverClientFactory.java      |  41 +++++++-
 .../hadoop/hdds/scm/XceiverClientManager.java      | 117 ++-------------------
 .../hadoop/ozone/freon/TestDNRPCLoadGenerator.java |  13 +--
 .../hadoop/ozone/freon/DNRPCLoadGenerator.java     |   7 +-
 .../hadoop/ozone/freon/DatanodeBlockPutter.java    |   7 +-
 .../hadoop/ozone/freon/DatanodeChunkGenerator.java |   7 +-
 .../hadoop/ozone/freon/DatanodeChunkValidator.java |   7 +-
 8 files changed, 186 insertions(+), 130 deletions(-)

diff --git 
a/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/XceiverClientCreator.java
 
b/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/XceiverClientCreator.java
new file mode 100644
index 0000000000..cd46bc49a1
--- /dev/null
+++ 
b/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/XceiverClientCreator.java
@@ -0,0 +1,117 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hdds.scm;
+
+import com.google.common.base.Preconditions;
+import org.apache.hadoop.hdds.conf.ConfigurationSource;
+import org.apache.hadoop.hdds.scm.client.ClientTrustManager;
+import org.apache.hadoop.hdds.scm.pipeline.Pipeline;
+import org.apache.hadoop.hdds.utils.IOUtils;
+import org.apache.hadoop.ozone.OzoneConfigKeys;
+import org.apache.hadoop.ozone.OzoneSecurityUtil;
+
+import java.io.IOException;
+
+/**
+ * Factory for XceiverClientSpi implementations.  Client instances are not 
cached.
+ */
+public class XceiverClientCreator implements XceiverClientFactory {
+  private final ConfigurationSource conf;
+  private final boolean topologyAwareRead;
+  private final ClientTrustManager trustManager;
+  private final boolean securityEnabled;
+
+  public XceiverClientCreator(ConfigurationSource conf) {
+    this(conf, null);
+  }
+
+  public XceiverClientCreator(ConfigurationSource conf, ClientTrustManager 
trustManager) {
+    this.conf = conf;
+    this.securityEnabled = OzoneSecurityUtil.isSecurityEnabled(conf);
+    topologyAwareRead = conf.getBoolean(
+        OzoneConfigKeys.OZONE_NETWORK_TOPOLOGY_AWARE_READ_KEY,
+        OzoneConfigKeys.OZONE_NETWORK_TOPOLOGY_AWARE_READ_DEFAULT);
+    this.trustManager = trustManager;
+    if (securityEnabled) {
+      Preconditions.checkNotNull(trustManager);
+    }
+  }
+
+  public boolean isSecurityEnabled() {
+    return securityEnabled;
+  }
+
+  protected XceiverClientSpi newClient(Pipeline pipeline) throws IOException {
+    XceiverClientSpi client;
+    switch (pipeline.getType()) {
+    case RATIS:
+      client = XceiverClientRatis.newXceiverClientRatis(pipeline, conf, 
trustManager);
+      break;
+    case STAND_ALONE:
+      client = new XceiverClientGrpc(pipeline, conf, trustManager);
+      break;
+    case EC:
+      client = new ECXceiverClientGrpc(pipeline, conf, trustManager);
+      break;
+    case CHAINED:
+    default:
+      throw new IOException("not implemented " + pipeline.getType());
+    }
+    try {
+      client.connect();
+    } catch (Exception e) {
+      throw new IOException(e);
+    }
+    return client;
+  }
+
+  @Override
+  public XceiverClientSpi acquireClient(Pipeline pipeline) throws IOException {
+    return acquireClient(pipeline, false);
+  }
+
+  @Override
+  public void releaseClient(XceiverClientSpi xceiverClient, boolean 
invalidateClient) {
+    releaseClient(xceiverClient, invalidateClient, false);
+  }
+
+  @Override
+  public XceiverClientSpi acquireClientForReadData(Pipeline pipeline) throws 
IOException {
+    return acquireClient(pipeline);
+  }
+
+  @Override
+  public void releaseClientForReadData(XceiverClientSpi xceiverClient, boolean 
invalidateClient) {
+    releaseClient(xceiverClient, invalidateClient, topologyAwareRead);
+  }
+
+  @Override
+  public XceiverClientSpi acquireClient(Pipeline pipeline, boolean 
topologyAware) throws IOException {
+    return newClient(pipeline);
+  }
+
+  @Override
+  public void releaseClient(XceiverClientSpi xceiverClient, boolean 
invalidateClient, boolean topologyAware) {
+    IOUtils.closeQuietly(xceiverClient);
+  }
+
+  @Override
+  public void close() throws Exception {
+    // clients are not tracked, closing each client is the responsibility of 
users of this class
+  }
+}
diff --git 
a/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/XceiverClientFactory.java
 
b/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/XceiverClientFactory.java
index 36c134b87a..b7276d645b 100644
--- 
a/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/XceiverClientFactory.java
+++ 
b/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/XceiverClientFactory.java
@@ -26,16 +26,53 @@ import org.apache.hadoop.hdds.scm.pipeline.Pipeline;
  */
 public interface XceiverClientFactory extends AutoCloseable {
 
+  /**
+   * Acquires a XceiverClientSpi connected to a container capable of
+   * storing the specified key. It does not consider the topology
+   * of the datanodes in the pipeline (e.g. closest datanode to the
+   * client)
+   *
+   * @param pipeline the container pipeline for the client connection
+   * @return XceiverClientSpi connected to a container
+   * @throws IOException if a XceiverClientSpi cannot be acquired
+   */
   XceiverClientSpi acquireClient(Pipeline pipeline) throws IOException;
 
-  void releaseClient(XceiverClientSpi xceiverClient, boolean invalidateClient);
+  /**
+   * Releases a XceiverClientSpi after use.
+   *
+   * @param client client to release
+   * @param invalidateClient if true, invalidates the client in cache
+   */
+  void releaseClient(XceiverClientSpi client, boolean invalidateClient);
 
+  /**
+   * Acquires a XceiverClientSpi connected to a container for read.
+   *
+   * @param pipeline the container pipeline for the client connection
+   * @return XceiverClientSpi connected to a container
+   * @throws IOException if a XceiverClientSpi cannot be acquired
+   */
   XceiverClientSpi acquireClientForReadData(Pipeline pipeline)
       throws IOException;
 
-  void releaseClientForReadData(XceiverClientSpi xceiverClient,
+  /**
+   * Releases a read XceiverClientSpi after use.
+   *
+   * @param client client to release
+   * @param invalidateClient if true, invalidates the client in cache
+   */
+  void releaseClientForReadData(XceiverClientSpi client,
                                 boolean invalidateClient);
 
+  /**
+   * Acquires a XceiverClientSpi connected to a container capable of
+   * storing the specified key.
+   *
+   * @param pipeline the container pipeline for the client connection
+   * @return XceiverClientSpi connected to a container
+   * @throws IOException if a XceiverClientSpi cannot be acquired
+   */
   XceiverClientSpi acquireClient(Pipeline pipeline, boolean topologyAware)
       throws IOException;
 
diff --git 
a/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/XceiverClientManager.java
 
b/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/XceiverClientManager.java
index 2190391d18..285a47ec57 100644
--- 
a/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/XceiverClientManager.java
+++ 
b/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/XceiverClientManager.java
@@ -19,7 +19,6 @@
 package org.apache.hadoop.hdds.scm;
 
 import java.io.IOException;
-import java.util.concurrent.Callable;
 import java.util.concurrent.TimeUnit;
 
 import org.apache.hadoop.hdds.conf.Config;
@@ -30,8 +29,6 @@ import org.apache.hadoop.hdds.protocol.DatanodeDetails;
 import org.apache.hadoop.hdds.protocol.proto.HddsProtos;
 import org.apache.hadoop.hdds.scm.client.ClientTrustManager;
 import org.apache.hadoop.hdds.scm.pipeline.Pipeline;
-import org.apache.hadoop.ozone.OzoneConfigKeys;
-import org.apache.hadoop.ozone.OzoneSecurityUtil;
 import org.apache.hadoop.security.UserGroupInformation;
 
 import com.google.common.annotations.VisibleForTesting;
@@ -61,18 +58,14 @@ import org.slf4j.LoggerFactory;
  * without reestablishing connection. But the connection will be closed if
  * not being used for a period of time.
  */
-public class XceiverClientManager implements XceiverClientFactory {
+public class XceiverClientManager extends XceiverClientCreator {
   private static final Logger LOG =
       LoggerFactory.getLogger(XceiverClientManager.class);
-  //TODO : change this to SCM configuration class
-  private final ConfigurationSource conf;
   private final Cache<String, XceiverClientSpi> clientCache;
   private final CacheMetrics cacheMetrics;
-  private ClientTrustManager trustManager;
 
   private static XceiverClientMetrics metrics;
-  private boolean isSecurityEnabled;
-  private final boolean topologyAwareRead;
+
   /**
    * Creates a new XceiverClientManager for non secured ozone cluster.
    * For security enabled ozone cluster, client should use the other 
constructor
@@ -87,15 +80,10 @@ public class XceiverClientManager implements 
XceiverClientFactory {
   public XceiverClientManager(ConfigurationSource conf,
       ScmClientConfig clientConf,
       ClientTrustManager trustManager) throws IOException {
+    super(conf, trustManager);
     Preconditions.checkNotNull(clientConf);
     Preconditions.checkNotNull(conf);
     long staleThresholdMs = clientConf.getStaleThreshold(MILLISECONDS);
-    this.conf = conf;
-    this.isSecurityEnabled = OzoneSecurityUtil.isSecurityEnabled(conf);
-    if (isSecurityEnabled) {
-      Preconditions.checkNotNull(trustManager);
-      this.trustManager = trustManager;
-    }
 
     this.clientCache = CacheBuilder.newBuilder()
         .recordStats()
@@ -114,9 +102,6 @@ public class XceiverClientManager implements 
XceiverClientFactory {
               }
             }
           }).build();
-    topologyAwareRead = conf.getBoolean(
-        OzoneConfigKeys.OZONE_NETWORK_TOPOLOGY_AWARE_READ_KEY,
-        OzoneConfigKeys.OZONE_NETWORK_TOPOLOGY_AWARE_READ_DEFAULT);
 
     cacheMetrics = CacheMetrics.create(clientCache, this);
   }
@@ -127,50 +112,10 @@ public class XceiverClientManager implements 
XceiverClientFactory {
   }
 
   /**
-   * Acquires a XceiverClientSpi connected to a container capable of
-   * storing the specified key. It does not consider the topology
-   * of the datanodes in the pipeline (e.g. closest datanode to the
-   * client)
-   *
-   * If there is already a cached XceiverClientSpi, simply return
-   * the cached otherwise create a new one.
-   *
-   * @param pipeline the container pipeline for the client connection
-   * @return XceiverClientSpi connected to a container
-   * @throws IOException if a XceiverClientSpi cannot be acquired
-   */
-  @Override
-  public XceiverClientSpi acquireClient(Pipeline pipeline)
-      throws IOException {
-    return acquireClient(pipeline, false);
-  }
-
-  /**
-   * Acquires a XceiverClientSpi connected to a container for read.
-   *
-   * If there is already a cached XceiverClientSpi, simply return
-   * the cached otherwise create a new one.
-   *
-   * @param pipeline the container pipeline for the client connection
-   * @return XceiverClientSpi connected to a container
-   * @throws IOException if a XceiverClientSpi cannot be acquired
-   */
-  @Override
-  public XceiverClientSpi acquireClientForReadData(Pipeline pipeline)
-      throws IOException {
-    return acquireClient(pipeline, topologyAwareRead);
-  }
-
-  /**
-   * Acquires a XceiverClientSpi connected to a container capable of
-   * storing the specified key.
+   * {@inheritDoc}
    *
    * If there is already a cached XceiverClientSpi, simply return
    * the cached otherwise create a new one.
-   *
-   * @param pipeline the container pipeline for the client connection
-   * @return XceiverClientSpi connected to a container
-   * @throws IOException if a XceiverClientSpi cannot be acquired
    */
   @Override
   public XceiverClientSpi acquireClient(Pipeline pipeline,
@@ -187,29 +132,6 @@ public class XceiverClientManager implements 
XceiverClientFactory {
     }
   }
 
-  /**
-   * Releases a XceiverClientSpi after use.
-   *
-   * @param client client to release
-   * @param invalidateClient if true, invalidates the client in cache
-   */
-  @Override
-  public void releaseClient(XceiverClientSpi client, boolean invalidateClient) 
{
-    releaseClient(client, invalidateClient, false);
-  }
-
-  /**
-   * Releases a read XceiverClientSpi after use.
-   *
-   * @param client client to release
-   * @param invalidateClient if true, invalidates the client in cache
-   */
-  @Override
-  public void releaseClientForReadData(XceiverClientSpi client,
-      boolean invalidateClient) {
-    releaseClient(client, invalidateClient, topologyAwareRead);
-  }
-
   @Override
   public void releaseClient(XceiverClientSpi client, boolean invalidateClient,
       boolean topologyAware) {
@@ -227,39 +149,16 @@ public class XceiverClientManager implements 
XceiverClientFactory {
     }
   }
 
-  private XceiverClientSpi getClient(Pipeline pipeline, boolean topologyAware)
+  protected XceiverClientSpi getClient(Pipeline pipeline, boolean 
topologyAware)
       throws IOException {
-    HddsProtos.ReplicationType type = pipeline.getType();
     try {
       // create different client different pipeline node based on
       // network topology
       String key = getPipelineCacheKey(pipeline, topologyAware);
-      return clientCache.get(key, new Callable<XceiverClientSpi>() {
-        @Override
-          public XceiverClientSpi call() throws Exception {
-            XceiverClientSpi client = null;
-            switch (type) {
-            case RATIS:
-              client = XceiverClientRatis.newXceiverClientRatis(pipeline, conf,
-                  trustManager);
-              break;
-            case STAND_ALONE:
-              client = new XceiverClientGrpc(pipeline, conf, trustManager);
-              break;
-            case EC:
-              client = new ECXceiverClientGrpc(pipeline, conf, trustManager);
-              break;
-            case CHAINED:
-            default:
-              throw new IOException("not implemented " + pipeline.getType());
-            }
-            client.connect();
-            return client;
-          }
-        });
+      return clientCache.get(key, () -> newClient(pipeline));
     } catch (Exception e) {
       throw new IOException(
-          "Exception getting XceiverClient: " + e.toString(), e);
+          "Exception getting XceiverClient: " + e, e);
     }
   }
 
@@ -293,7 +192,7 @@ public class XceiverClientManager implements 
XceiverClientFactory {
       }
     }
 
-    if (isSecurityEnabled) {
+    if (isSecurityEnabled()) {
       // Append user short name to key to prevent a different user
       // from using same instance of xceiverClient.
       try {
diff --git 
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/freon/TestDNRPCLoadGenerator.java
 
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/freon/TestDNRPCLoadGenerator.java
index f209783c74..33d59f101e 100644
--- 
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/freon/TestDNRPCLoadGenerator.java
+++ 
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/freon/TestDNRPCLoadGenerator.java
@@ -22,7 +22,8 @@ import org.apache.hadoop.hdds.conf.DatanodeRatisServerConfig;
 import org.apache.hadoop.hdds.conf.OzoneConfiguration;
 import org.apache.hadoop.hdds.protocol.proto.HddsProtos;
 import org.apache.hadoop.hdds.ratis.conf.RatisClientConfig;
-import org.apache.hadoop.hdds.scm.XceiverClientManager;
+import org.apache.hadoop.hdds.scm.XceiverClientCreator;
+import org.apache.hadoop.hdds.scm.XceiverClientFactory;
 import org.apache.hadoop.hdds.scm.XceiverClientSpi;
 import 
org.apache.hadoop.hdds.scm.container.common.helpers.ContainerWithPipeline;
 import 
org.apache.hadoop.hdds.scm.protocolPB.StorageContainerLocationProtocolClientSideTranslatorPB;
@@ -79,11 +80,11 @@ public class TestDNRPCLoadGenerator {
         storageContainerLocationClient.allocateContainer(
             SCMTestUtils.getReplicationType(conf),
             HddsProtos.ReplicationFactor.ONE, OzoneConsts.OZONE);
-    XceiverClientManager xceiverClientManager = new XceiverClientManager(conf);
-    XceiverClientSpi client = xceiverClientManager
-        .acquireClient(container.getPipeline());
-    ContainerProtocolCalls.createContainer(client,
-        container.getContainerInfo().getContainerID(), null);
+    try (XceiverClientFactory factory = new XceiverClientCreator(conf);
+        XceiverClientSpi client = 
factory.acquireClient(container.getPipeline())) {
+      ContainerProtocolCalls.createContainer(client,
+          container.getContainerInfo().getContainerID(), null);
+    }
   }
 
   static void shutdownCluster() {
diff --git 
a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/DNRPCLoadGenerator.java
 
b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/DNRPCLoadGenerator.java
index 3b4d25cdda..f83b2a1a4a 100644
--- 
a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/DNRPCLoadGenerator.java
+++ 
b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/DNRPCLoadGenerator.java
@@ -24,8 +24,8 @@ import org.apache.hadoop.hdds.cli.HddsVersionProvider;
 import org.apache.hadoop.hdds.client.StandaloneReplicationConfig;
 import org.apache.hadoop.hdds.conf.OzoneConfiguration;
 import org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos;
+import org.apache.hadoop.hdds.scm.XceiverClientCreator;
 import org.apache.hadoop.hdds.scm.XceiverClientFactory;
-import org.apache.hadoop.hdds.scm.XceiverClientManager;
 import org.apache.hadoop.hdds.scm.XceiverClientSpi;
 import org.apache.hadoop.hdds.scm.cli.ContainerOperationClient;
 import org.apache.hadoop.hdds.scm.client.ClientTrustManager;
@@ -152,11 +152,10 @@ public class DNRPCLoadGenerator extends BaseFreonGenerator
     XceiverClientFactory xceiverClientManager;
     if (OzoneSecurityUtil.isSecurityEnabled(configuration)) {
       CACertificateProvider caCerts = () -> HAUtils.buildCAX509List(null, 
configuration);
-      xceiverClientManager = new XceiverClientManager(configuration,
-          configuration.getObject(XceiverClientManager.ScmClientConfig.class),
+      xceiverClientManager = new XceiverClientCreator(configuration,
           new ClientTrustManager(caCerts, null));
     } else {
-      xceiverClientManager = new XceiverClientManager(configuration);
+      xceiverClientManager = new XceiverClientCreator(configuration);
     }
     clients = new ArrayList<>(numClients);
     for (int i = 0; i < numClients; i++) {
diff --git 
a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/DatanodeBlockPutter.java
 
b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/DatanodeBlockPutter.java
index f6a5c59650..3e613d2d2c 100644
--- 
a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/DatanodeBlockPutter.java
+++ 
b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/DatanodeBlockPutter.java
@@ -29,7 +29,8 @@ import 
org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos.ChunkInfo;
 import 
org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos.ContainerCommandRequestProto;
 import 
org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos.PutBlockRequestProto;
 import org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos.Type;
-import org.apache.hadoop.hdds.scm.XceiverClientManager;
+import org.apache.hadoop.hdds.scm.XceiverClientCreator;
+import org.apache.hadoop.hdds.scm.XceiverClientFactory;
 import org.apache.hadoop.hdds.scm.XceiverClientSpi;
 import org.apache.hadoop.hdds.scm.pipeline.Pipeline;
 import org.apache.hadoop.hdds.scm.protocol.StorageContainerLocationProtocol;
@@ -99,8 +100,8 @@ public class DatanodeBlockPutter extends BaseFreonGenerator 
implements
       Pipeline pipeline =
           findPipelineForTest(pipelineId, scmLocationClient, LOG);
 
-      try (XceiverClientManager xceiverClientManager =
-               new XceiverClientManager(ozoneConf)) {
+      try (XceiverClientFactory xceiverClientManager =
+               new XceiverClientCreator(ozoneConf)) {
         client = xceiverClientManager.acquireClient(pipeline);
 
         timer = getMetrics().timer("put-block");
diff --git 
a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/DatanodeChunkGenerator.java
 
b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/DatanodeChunkGenerator.java
index 23988106d4..7f0f5bb9e5 100644
--- 
a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/DatanodeChunkGenerator.java
+++ 
b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/DatanodeChunkGenerator.java
@@ -36,7 +36,8 @@ import 
org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos.ContainerC
 import 
org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos.DatanodeBlockID;
 import org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos.Type;
 import 
org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos.WriteChunkRequestProto;
-import org.apache.hadoop.hdds.scm.XceiverClientManager;
+import org.apache.hadoop.hdds.scm.XceiverClientCreator;
+import org.apache.hadoop.hdds.scm.XceiverClientFactory;
 import org.apache.hadoop.hdds.scm.XceiverClientReply;
 import org.apache.hadoop.hdds.scm.XceiverClientSpi;
 import org.apache.hadoop.hdds.scm.pipeline.Pipeline;
@@ -117,8 +118,8 @@ public class DatanodeChunkGenerator extends 
BaseFreonGenerator implements
 
     try (StorageContainerLocationProtocol scmLocationClient =
                createStorageContainerLocationClient(ozoneConf);
-         XceiverClientManager xceiverClientManager =
-             new XceiverClientManager(ozoneConf)) {
+         XceiverClientFactory xceiverClientManager =
+             new XceiverClientCreator(ozoneConf)) {
       List<Pipeline> pipelinesFromSCM = scmLocationClient.listPipelines();
       Pipeline firstPipeline;
       init();
diff --git 
a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/DatanodeChunkValidator.java
 
b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/DatanodeChunkValidator.java
index 2bbf8b6d5b..0b1e34efe7 100644
--- 
a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/DatanodeChunkValidator.java
+++ 
b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/DatanodeChunkValidator.java
@@ -24,7 +24,8 @@ import org.apache.hadoop.hdds.conf.OzoneConfiguration;
 import org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos;
 import 
org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos.ContainerCommandRequestProto;
 import 
org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos.ContainerCommandResponseProto;
-import org.apache.hadoop.hdds.scm.XceiverClientManager;
+import org.apache.hadoop.hdds.scm.XceiverClientCreator;
+import org.apache.hadoop.hdds.scm.XceiverClientFactory;
 import org.apache.hadoop.hdds.scm.XceiverClientSpi;
 import org.apache.hadoop.hdds.scm.pipeline.Pipeline;
 import org.apache.hadoop.hdds.scm.protocol.StorageContainerLocationProtocol;
@@ -91,8 +92,8 @@ public class DatanodeChunkValidator extends BaseFreonGenerator
                  createStorageContainerLocationClient(ozoneConf)) {
       Pipeline pipeline = findPipelineForTest(pipelineId, scmClient, LOG);
 
-      try (XceiverClientManager xceiverClientManager =
-                   new XceiverClientManager(ozoneConf)) {
+      try (XceiverClientFactory xceiverClientManager =
+                   new XceiverClientCreator(ozoneConf)) {
         xceiverClient = 
xceiverClientManager.acquireClientForReadData(pipeline);
 
         checksumProtobuf = ContainerProtos.ChecksumData.newBuilder()


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to