Hi,
I have written a code to check whether HSQl,
JBoss, Radius (AAA sever) and MySQL is running or not.The code is written in an inifinte while loop to continuously monitor.Now I tested that if this service(let's say hsql) is running then "/bin/bash -c ps -ef | grep 'hsql' | wc -l" will return 3 when this is passed as an argument in Runtime.exec() method.Now I have come to know following facts
1.The inputstream or errstream of the forked process must not be overflowed.Otherwise it 'll cause deadlock.
Keeping that in mind I have written this code
Output I'm expecting as follows
HSQL is running/not running 1
JBoss is running/not running 1
MySQL is running/not running 1
-------------------1----------------
HSQL is running/not running 2
JBoss is running/not running 2
MySQL is running/not running 2
-------------------2----------------
and so on...
Howevere I'm not getting like that.Some times HSQL's status message is not printed or sometimes JBoss status message is not printed.Even sometimes I got the output like
------------------1----------------------
after this status messages are printed.All I'm trying to say is that seems to be some race condition or some synchronization problem.
Thanks & Regards,
Arka