Request a .getName() function to return a descriptive name to each of the classes shown below: Host.getName() would return the Host name associated with that Host Proc.getName() would return the Proc name associated with that Proc Task.getName() would return the Task name associated with that thread of execution
pmuldoon cagney, something like: java.net.InetAddress.getLocalHost().getHostName()
cagney pmuldoon, ok, I wonder how I test this pmuldoon cagney, you could spawn a process that runs: uname -n and capture the output and compare the two? They should be the same
2005-10-31 Phil Muldoon <pmuldoon@redhat.com> * Host.java (getName): Added getName function. * Task.java (getName): Added getName function. Added some simple functions that return "Task "+getTid() in the Task's case, and java.net.InetAddress.getLocalHost().getHostName() in the Hosts case.
Added the Task and the Host some time back and forgot to close. Proc has a .getCommand() already implemented. Task: /** * Return the task's (derived) name */ public final String getName () { return "Task " + getTid(); } Proc: /** * Return the basename of the program that this process is * running. */ public String getCommand () { command = sendrecCommand (); return command; } Host: /** * * Returns the name of the host */ public String getName() { try { return java.net.InetAddress.getLocalHost().getHostName(); } catch (UnknownHostException e) { return "Unknown Host"; } }
Closing