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 faa1ec67d99..8c8cb95d5c5 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. * 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 7955179a17f..184c5478fdf 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.