diff options
| author | Chris Lu <chris.lu@gmail.com> | 2020-11-03 00:46:00 -0800 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2020-11-03 00:46:00 -0800 |
| commit | c709059b690e2e5c70b262f4c884bb784cd1781a (patch) | |
| tree | 902e4968ffdc36c104ed08f03edcacd6d0f15b11 | |
| parent | d29b787220b9e4129ad91aec52f8731cccbb5001 (diff) | |
| download | seaweedfs-c709059b690e2e5c70b262f4c884bb784cd1781a.tar.xz seaweedfs-c709059b690e2e5c70b262f4c884bb784cd1781a.zip | |
HCFS: add close() to SeaweedFileSystem.java
4 files changed, 28 insertions, 0 deletions
diff --git a/other/java/hdfs2/src/main/java/seaweed/hdfs/SeaweedFileSystem.java b/other/java/hdfs2/src/main/java/seaweed/hdfs/SeaweedFileSystem.java index ca67c3874..69df55cf1 100644 --- a/other/java/hdfs2/src/main/java/seaweed/hdfs/SeaweedFileSystem.java +++ b/other/java/hdfs2/src/main/java/seaweed/hdfs/SeaweedFileSystem.java @@ -66,6 +66,12 @@ public class SeaweedFileSystem extends FileSystem { } @Override + public void close() throws IOException { + this.seaweedFileSystemStore.close(); + super.close(); + } + + @Override public FSDataInputStream open(Path path, int bufferSize) throws IOException { LOG.debug("open path: {} bufferSize:{}", path, bufferSize); diff --git a/other/java/hdfs2/src/main/java/seaweed/hdfs/SeaweedFileSystemStore.java b/other/java/hdfs2/src/main/java/seaweed/hdfs/SeaweedFileSystemStore.java index 23556a578..cec309b3e 100644 --- a/other/java/hdfs2/src/main/java/seaweed/hdfs/SeaweedFileSystemStore.java +++ b/other/java/hdfs2/src/main/java/seaweed/hdfs/SeaweedFileSystemStore.java @@ -36,6 +36,14 @@ public class SeaweedFileSystemStore { this.conf = conf; } + public void close() { + try { + this.filerGrpcClient.shutdown(); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + public static String getParentDirectory(Path path) { return path.isRoot() ? "/" : path.getParent().toUri().getPath(); } diff --git a/other/java/hdfs3/src/main/java/seaweed/hdfs/SeaweedFileSystem.java b/other/java/hdfs3/src/main/java/seaweed/hdfs/SeaweedFileSystem.java index ca67c3874..69df55cf1 100644 --- a/other/java/hdfs3/src/main/java/seaweed/hdfs/SeaweedFileSystem.java +++ b/other/java/hdfs3/src/main/java/seaweed/hdfs/SeaweedFileSystem.java @@ -66,6 +66,12 @@ public class SeaweedFileSystem extends FileSystem { } @Override + public void close() throws IOException { + this.seaweedFileSystemStore.close(); + super.close(); + } + + @Override public FSDataInputStream open(Path path, int bufferSize) throws IOException { LOG.debug("open path: {} bufferSize:{}", path, bufferSize); diff --git a/other/java/hdfs3/src/main/java/seaweed/hdfs/SeaweedFileSystemStore.java b/other/java/hdfs3/src/main/java/seaweed/hdfs/SeaweedFileSystemStore.java index 23556a578..cec309b3e 100644 --- a/other/java/hdfs3/src/main/java/seaweed/hdfs/SeaweedFileSystemStore.java +++ b/other/java/hdfs3/src/main/java/seaweed/hdfs/SeaweedFileSystemStore.java @@ -36,6 +36,14 @@ public class SeaweedFileSystemStore { this.conf = conf; } + public void close() { + try { + this.filerGrpcClient.shutdown(); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + public static String getParentDirectory(Path path) { return path.isRoot() ? "/" : path.getParent().toUri().getPath(); } |
