next up previous contents
Next: The GUIAdmin Up: Admin System Agents Previous: SystemAdminIFace   Contents

The ConsoleAdmin

The ConsoleAdmin provides a text based command line interface for controlling the System. It writes all output to the standard output stream as defined in java.lang.System.out. The output of the belonging parts of the System is not written synchronously to the output stream as this could result in very mixed output. If for example two Agents writing at the same time some lines, these lines would be put mixed on the console. To prevent this case the ConsoleAdmin collects the output of the (System) Agents and the System in a hash table of string buffers and writes them by using a thread at once on the display. The thread used for the collected output is called ConsoleAdminOutputThread and does nothing more then looking at all string buffers and, if some ouput is available, writing the lines on the screen. The system buffer is handled first to provide it with a higher priority. The run method sleeps in every loop one second if no new data is available. If the ConsoleAdmin gets a request to write something on the screen it puts the lines into the belonging string buffer and interrupts the ConsoleAdminOutputThread. The mechanism prevents the thread from using too much CPU time, but keeps the delay time between calling one of the print method and the output on the screen very small.

The second thread used by the ConsoleAdmin is responsible for the input of the administrator. The ConsoleAdmin provides the system administrator with a command prompt and a small help. The command prompt ``ConsoleAdmin > `` tells the administrator that the admin service is ready for commands from the user. The prompt could be invisible sometimes caused by the asynchronous output mechanism. If this is the case it will rewritten to screen when pressing just <RETURN>. The ConsoleAdmin recognizes the following commands, a up to date list is always available with the command ``help'':

help
Prints a list of the available commandos and a small description on the screen.
terminateSystem
Shuts down the System. The command is also available through writing ``quit''. The ConsoleAdmin calls the shutdown method of the platform when given this command.
listAgents
Writes a list of all Agents and System Agents on the screen. The list consists mainly of the strings representing the AgentID (AgentID.toString()). The ConsoleAdmin queries therefor the platform for the complete and up to date list of Agents and System Agents.
listProxies
Writes a list of all registered interfaces and their belonging proxies on the screen. This list is split by interfaces and not by proxies so that proxies that implement more then one interface are appearing more times.
listThreads
List all threads belonging to the main thread group and their sub-groups. This should list all threads executing in the System, because Agents should execute their threads in their desired group and System Agent can execute in the main thread group. The output is done by calling the ThreadGroup.list() on the main thread group. This command lists the threads then recursively through all subgroups.
createAgent <full_name>
Creates a new Agent with the class name as parameter. The class name parameter has to be the full package path to the class, for example ``tagents.examples.AgentEx3''. When using authority based authentication in the System in future it could take another parameter for the authority. The Agent will be started automatically when calling the method.
stopAgent <id>
Stops the given Agent. The Agent to stop is identified by the id string given as parameter. The id string is converted into an AgentID and then the ConsoleAdmin calls the stopAgent method of the platform.
startAgent <id>
(Re-) Starts the given Agent. This is be done by calling the resumeAgent of the platform.
concludeAgent <id>
Concludes (terminates) the given Agent.
totalMemory
Shows the amount of memory available in the JVM and the bytes already used by the System.
gc
Runs the java garbage collector. This should not be necessary to call since the JVM provide a asynchronous garbage collecting mechanism. This option was used for debug purposes.


next up previous contents
Next: The GUIAdmin Up: Admin System Agents Previous: SystemAdminIFace   Contents
Thomas Letsch 2001-02-21