Need help in thread concept
My requirement is to execute a shell script from java and write the output to a file using java. If the script execution takes more than 10 mins i should kill that script execution process.
Now writing to a file and monitoring the time should happen simultaneously and once the time reaches ten min , script should be killed. I am not sure how to write this part. Please helop me on this
Thanks a lot but still a small clarification
That was a nice explanation. But in the code we are setting isRunnable=false only after calling process.waitFor() method . In this case it will wait till the process is completed but if my process exceeds 10 mins i want to kill it directly . Also am new to threading let me look into it.