A small process controller application
To summarize and put into use all that we have learned in this chapter we look at a sample process control application. The functionality of the application is very simple. It reads from a series of configuration file(s) parameters how to start some processes and then if any of them stops, it tries to restart the process.
Even a real life application can be created from this demo version. You can extend the set of parameters of the process with environment variable specifications. You can add default directory for the process, input and output redirection or even how much CPU a process is allowed to consume without the controlling application killing and restarting it.
The application consists of four classes.
Main
: This class that contains the public static void main method and is used to start up the daemon.Parameters
: This class contains the configuration parameters for a process. In this simple case it will only contain one field, thecommandLine
....