Skip to content

Commit

Permalink
3
Browse files Browse the repository at this point in the history
  • Loading branch information
wsjz committed Jul 30, 2024
1 parent 72c61d0 commit 8eca3fb
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public class HdfsStorage extends BlobStorage {
private final int readBufferSize = 128 << 10; // 128k
private final int writeBufferSize = 128 << 10; // 128k

private FileSystem dfsFileSystem = null;
private volatile FileSystem dfsFileSystem = null;

/**
* init HdfsStorage with properties.
Expand All @@ -86,6 +86,9 @@ public static String getFsName(String path) {

@Override
public FileSystem getFileSystem(String remotePath) throws UserException {
if (dfsFileSystem != null) {
return dfsFileSystem;
}
synchronized (this) {
if (dfsFileSystem == null) {
String username = hdfsProperties.get(HdfsResource.HADOOP_USER_NAME);
Expand All @@ -98,7 +101,7 @@ public FileSystem getFileSystem(String remotePath) throws UserException {
isSecurityEnabled = true;
}
}

conf.set("fs.hdfs.impl.disable.cache", "true");
try {
if (isSecurityEnabled) {
UserGroupInformation.setConfiguration(conf);
Expand All @@ -117,7 +120,6 @@ public FileSystem getFileSystem(String remotePath) throws UserException {
}
}
}

return dfsFileSystem;
}

Expand Down

0 comments on commit 8eca3fb

Please sign in to comment.