入力ストリームから読み取り、finallyブロックでin.close();を呼び出して閉じようとします。ただし、mainの実行はブロックされます。抜け道は何ですか?
提案では、私が使用したコードは、
if (!processed) {
System.out.println("in processed");
byte[] contents = new byte[(int) fileSplit.getLength()];
Path file = fileSplit.getPath();
FileSystem fs = file.getFileSystem(conf);
FSDataInputStream in = null;
try {
in = fs.open(file);
IOUtils.readFully(in, contents, 0, contents.length);
value.set(contents, 0, contents.length);
} finally {
System.out.println("before close stream");
IOUtils.closeStream(in);
}
processed = true;
return true;
}
System.out.println("out of processed");
return false;
}