In my window-based java application, i am creating a subprocess to copy files from one location to another using robocopy. The thread creating the subprocess waits for the subprocess until it is terminated. There are seldom chances wherein this subprocess stucks. For this, I want to write a monitor which will watch this subprocess until it is terminated properly or inform whether it is stuck. Is there a better design which can help us achieve this. Robocopy while copying generates the log file which can be used to see if the subprocess is actually running. I am confused with how to approach this problem. Currently what i have in mind is to have this subprocess act as a data generator in this case log file, and the monitor which will keep track of this log file and let the observer, basically the thread who creates the subprocess knows of the current status of the process, so that the parent thread can kill that Process or wait for its completion. Is this design fine or can we approach it in a better way
Aucun commentaire:
Enregistrer un commentaire