Y
yuanyun.ken
occasionally, after a long period, our product throws "Too many open
files".
So I want to make sure the code closes all stream after having used
it.
And from http://www.vnoel.com/Computers-Related-Issues/Java-problem-Too-many-open-files.html,
http://www.velocityreviews.com/forums/t139735-too-many-open-named-pipes-in-a-java-process.html
I see Runtime.getProcess() method automatically opens three streams
(stdout, stderr, stdin) each time the getProcess() is called. It is
the responsibility of the caller to close those streams when done.
But if I just call it directly like this:
Runtime.getRuntime().exec("chmod 777 " + getFileName());
and doesn't get the returned Process and doesn't call
process.getInputStream()
Do I still need to close stream and how?
Any help is appreciated.
files".
So I want to make sure the code closes all stream after having used
it.
And from http://www.vnoel.com/Computers-Related-Issues/Java-problem-Too-many-open-files.html,
http://www.velocityreviews.com/forums/t139735-too-many-open-named-pipes-in-a-java-process.html
I see Runtime.getProcess() method automatically opens three streams
(stdout, stderr, stdin) each time the getProcess() is called. It is
the responsibility of the caller to close those streams when done.
But if I just call it directly like this:
Runtime.getRuntime().exec("chmod 777 " + getFileName());
and doesn't get the returned Process and doesn't call
process.getInputStream()
Do I still need to close stream and how?
Any help is appreciated.