[
https://issues.apache.org/jira/browse/HDFS-7330?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15256240#comment-15256240
]
Andras Bokor commented on HDFS-7330:
------------------------------------
I do not see these warnings. The assumption is true btw, so the underling
RandomAccessFile gets closed once the Inputstream is closed. See the following
small PoC:
{code}
RandomAccessFile fis1 = new RandomAccessFile(new File("/tmp/test.log"),"r");
FileInputStream fis2 = new FileInputStream(fis1.getFD());
fis2.close();
Thread.sleep(200);
System.out.println("Read fis1...");
fis1.read();
fis1.close();
{code}
{code}
Read fis1...
Exception in thread "main" java.io.IOException: Stream Closed
at java.io.RandomAccessFile.read0(Native Method)
at java.io.RandomAccessFile.read(RandomAccessFile.java:330)
at Main.main(Main.java:13)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
Process finished with exit code 1
{code}
Where do you see the warnings?
> Unclosed RandomAccessFile warnings in FSDatasetIml.
> ---------------------------------------------------
>
> Key: HDFS-7330
> URL: https://issues.apache.org/jira/browse/HDFS-7330
> Project: Hadoop HDFS
> Issue Type: Improvement
> Components: datanode
> Affects Versions: 2.5.1
> Reporter: Konstantin Shvachko
> Assignee: Milan Desai
> Labels: newbie
>
> RandomAccessFile is opened as an underline file for FileInputStream. It
> should be closed when the stream is closed. So to fix these 2 warning (in
> getBlockInputStream() and getTmpInputStreams()) we just need suppress them.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)