hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cli...@apache.org
Subject hadoop git commit: HDFS-12050. Ozone: StorageHandler: Implementation of close for releasing resources during shutdown. Contributed by Nandakumar.
Date Thu, 29 Jun 2017 21:44:01 GMT
Repository: hadoop
Updated Branches:
  refs/heads/HDFS-7240 4c683936e -> ba647764f


HDFS-12050. Ozone: StorageHandler: Implementation of close for releasing resources during
shutdown. Contributed by Nandakumar.


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

Branch: refs/heads/HDFS-7240
Commit: ba647764f3bccc318956b24104f972f4c9b0d35d
Parents: 4c68393
Author: Chen Liang <cliang@apache.org>
Authored: Thu Jun 29 14:43:30 2017 -0700
Committer: Chen Liang <cliang@apache.org>
Committed: Thu Jun 29 14:43:30 2017 -0700

----------------------------------------------------------------------
 .../java/org/apache/hadoop/scm/XceiverClientManager.java  |  9 +++++++++
 .../hadoop/hdfs/server/datanode/ObjectStoreHandler.java   |  1 +
 .../hadoop/ozone/web/interfaces/StorageHandler.java       |  5 +++++
 .../ozone/web/localstorage/LocalStorageHandler.java       |  5 +++++
 .../ozone/web/storage/DistributedStorageHandler.java      | 10 ++++++++++
 5 files changed, 30 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/ba647764/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/scm/XceiverClientManager.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/scm/XceiverClientManager.java
b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/scm/XceiverClientManager.java
index 9a5f68d..62e5af1 100644
--- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/scm/XceiverClientManager.java
+++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/scm/XceiverClientManager.java
@@ -154,4 +154,13 @@ public class XceiverClientManager {
       throw new IOException("Exception getting XceiverClient.", e);
     }
   }
+
+  /**
+   * Close and remove all the cached clients.
+   */
+  public void close() {
+    //closing is done through RemovalListener
+    clientCache.invalidateAll();
+    clientCache.cleanUp();
+  }
 }

http://git-wip-us.apache.org/repos/asf/hadoop/blob/ba647764/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/ObjectStoreHandler.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/ObjectStoreHandler.java
b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/ObjectStoreHandler.java
index 0bcb058..ab89ede 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/ObjectStoreHandler.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/ObjectStoreHandler.java
@@ -177,6 +177,7 @@ public final class ObjectStoreHandler implements Closeable {
   @Override
   public void close() {
     LOG.info("Closing ObjectStoreHandler.");
+    storageHandler.close();
     if (this.storageContainerLocationClient != null) {
       this.storageContainerLocationClient.close();
     }

http://git-wip-us.apache.org/repos/asf/hadoop/blob/ba647764/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/interfaces/StorageHandler.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/interfaces/StorageHandler.java
b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/interfaces/StorageHandler.java
index 52eb349..05f12e4 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/interfaces/StorageHandler.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/interfaces/StorageHandler.java
@@ -273,4 +273,9 @@ public interface StorageHandler {
    * @throws IOException
    */
   ListKeys listKeys(ListArgs args) throws IOException, OzoneException;
+
+  /**
+   * Closes all the opened resources.
+   */
+  void close();
 }

http://git-wip-us.apache.org/repos/asf/hadoop/blob/ba647764/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/localstorage/LocalStorageHandler.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/localstorage/LocalStorageHandler.java
b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/localstorage/LocalStorageHandler.java
index cb8db32..387eb16 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/localstorage/LocalStorageHandler.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/localstorage/LocalStorageHandler.java
@@ -353,4 +353,9 @@ public class LocalStorageHandler implements StorageHandler {
 
   }
 
+  @Override
+  public void close() {
+    //No resource to close, do nothing.
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/hadoop/blob/ba647764/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/storage/DistributedStorageHandler.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/storage/DistributedStorageHandler.java
b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/storage/DistributedStorageHandler.java
index dfd0a96..a6887fe 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/storage/DistributedStorageHandler.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/storage/DistributedStorageHandler.java
@@ -509,4 +509,14 @@ public final class DistributedStorageHandler implements StorageHandler
{
     sdf.setTimeZone(TimeZone.getTimeZone(OzoneConsts.OZONE_TIME_ZONE));
     return sdf.format(date);
   }
+
+  /**
+   * Closes DistributedStorageHandler.
+   */
+  @Override
+  public void close() {
+    if(xceiverClientManager != null) {
+      xceiverClientManager.close();
+    }
+  }
 }


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


Mime
View raw message