Hadoop Filesystem 多次close的问题

多线程并发调用org.apache.hadoop.fs.FileSystem.close() 可能导致其他线程

java.io.IOException: Filesystem closed

        at org.apache.hadoop.hdfs.DFSClient.checkOpen(DFSClient.java:565)
        at org.apache.hadoop.hdfs.DFSClient.getFileInfo(DFSClient.java:1543)
        at org.apache.hadoop.hdfs.DistributedFileSystem.getFileStatus(DistributedFileSystem.java:819)


原因:

FileSystem.get(getConf())返回的可能是一个cache中的结果


解决方案:

添加fs.hdfs.impl.disable.cache到hdfs-site.xml

 
    fs.hdfs.impl.disable.cache
    true
 

你可能感兴趣的:(Hadoop)