1
0
Fork 0
mirror of https://github.com/chrislusf/seaweedfs synced 2024-07-04 16:16:58 +02:00

HCFS: add close() to SeaweedFileSystem.java

This commit is contained in:
Chris Lu 2020-11-03 00:46:00 -08:00
parent d29b787220
commit c709059b69
4 changed files with 28 additions and 0 deletions

View file

@ -65,6 +65,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 {

View file

@ -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();
}

View file

@ -65,6 +65,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 {

View file

@ -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();
}