I am using the following code to run the shell script continuously.
String[] process = new String[] {"/bin/sh", "-c","pgrep httpd" };
Process proc = new ProcessBuilder(process).start();
InputStreamReader input = new InputStreamReader(proc
.getInputStream());
BufferedReader reader = new BufferedReader(input);
String line = reader.readLine();
reader.close();
input.close();
When run this code in thread, I am getting the error message
MESSAGE: Too many open files
java.net.SocketException: Too many open files
and
Cannot run program "/bin/sh": java.io.IOException: error=24, Too many open files.
How to avoid this issue .