You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by xy...@apache.org on 2018/08/27 15:20:00 UTC

hadoop git commit: HDDS-377. Make the ScmClient closable and stop the started threads. Contributed by Elek Marton.

Repository: hadoop
Updated Branches:
  refs/heads/trunk 84973d104 -> 6eecd251d


HDDS-377. Make the ScmClient closable and stop the started threads. Contributed by Elek Marton.


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/6eecd251
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/6eecd251
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/6eecd251

Branch: refs/heads/trunk
Commit: 6eecd251d8cf92e9cd7567734cbf8b38857118fb
Parents: 84973d1
Author: Xiaoyu Yao <xy...@apache.org>
Authored: Mon Aug 27 08:19:05 2018 -0700
Committer: Xiaoyu Yao <xy...@apache.org>
Committed: Mon Aug 27 08:19:38 2018 -0700

----------------------------------------------------------------------
 .../hadoop/hdds/scm/client/ContainerOperationClient.java    | 9 +++++++++
 .../java/org/apache/hadoop/hdds/scm/client/ScmClient.java   | 9 ++++++---
 2 files changed, 15 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/6eecd251/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/client/ContainerOperationClient.java
----------------------------------------------------------------------
diff --git a/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/client/ContainerOperationClient.java b/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/client/ContainerOperationClient.java
index faa1ec6..8c8cb95 100644
--- a/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/client/ContainerOperationClient.java
+++ b/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/client/ContainerOperationClient.java
@@ -257,6 +257,15 @@ public class ContainerOperationClient implements ScmClient {
         factor, nodePool);
   }
 
+  @Override
+  public void close() {
+    try {
+      xceiverClientManager.close();
+    } catch (Exception ex) {
+      LOG.error("Can't close " + this.getClass().getSimpleName(), ex);
+    }
+  }
+
   /**
    * Deletes an existing container.
    *

http://git-wip-us.apache.org/repos/asf/hadoop/blob/6eecd251/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/client/ScmClient.java
----------------------------------------------------------------------
diff --git a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/client/ScmClient.java b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/client/ScmClient.java
index 7955179..184c547 100644
--- a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/client/ScmClient.java
+++ b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/client/ScmClient.java
@@ -25,6 +25,7 @@ import org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos
     .ContainerData;
 import org.apache.hadoop.hdds.protocol.proto.HddsProtos;
 
+import java.io.Closeable;
 import java.io.IOException;
 import java.util.List;
 
@@ -39,7 +40,7 @@ import java.util.List;
  * this interface will likely be removed.
  */
 @InterfaceStability.Unstable
-public interface ScmClient {
+public interface ScmClient extends Closeable {
   /**
    * Creates a Container on SCM and returns the pipeline.
    * @return ContainerInfo
@@ -61,7 +62,8 @@ public interface ScmClient {
    * @return ContainerWithPipeline
    * @throws IOException
    */
-  ContainerWithPipeline getContainerWithPipeline(long containerId) throws IOException;
+  ContainerWithPipeline getContainerWithPipeline(long containerId)
+      throws IOException;
 
   /**
    * Close a container.
@@ -87,7 +89,8 @@ public interface ScmClient {
    * @param force - true to forcibly delete the container.
    * @throws IOException
    */
-  void deleteContainer(long containerId, Pipeline pipeline, boolean force) throws IOException;
+  void deleteContainer(long containerId, Pipeline pipeline, boolean force)
+      throws IOException;
 
   /**
    * Deletes an existing container.


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org