When a new instance of it is created it calls the method
initSystem
to do initialization work. First it gets its parameter from the configuration
and then it loads the System Agents that are set to be loaded. This is the part
which is defined in the configuration file. If a MAFFinderService or MAFFinderProxy
was loaded it uses its registered proxy to register itself at the MAFFinder.
When there was already a Agent System registered with the same ID (same name
at the same machine) it exits with an error.
Now the System has initialized and is ready to listen to requests from Agents
or System Agents. To keep the virtual machine running there has to be a thread
executing. Since the AgentSystem is the main part of the System
it had to extended the Thread class and to provide a run
method which stops only at the termination of the whole System. Therefor the
run method of the AgentSystem has a internal loop
which sleeps 200ms to not abuse too much processor time. The loop exits when
the boolean variable running is set to false which is done when stopping
the System.