com.sun.faban.harness.agent
Class ToolAgentImpl

java.lang.Object
  extended by java.rmi.server.RemoteObject
      extended by java.rmi.server.RemoteServer
          extended by java.rmi.server.UnicastRemoteObject
              extended by com.sun.faban.harness.agent.ToolAgentImpl
All Implemented Interfaces:
ToolAgent, Serializable, Remote, Unreferenced

public class ToolAgentImpl
extends UnicastRemoteObject
implements ToolAgent, Unreferenced

This class implements the ToolAgent interface. It runs in a seperate VM and is started by the GenericBenchmark. It configures and manages all tools on a particular machine and performs the ToolService API functions for this machine. Each tool is run as a seperate thread.

Author:
Ramesh Ramachandran
See Also:
ToolService, GenericBenchmark, Serialized Form

Field Summary
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Constructor Summary
ToolAgentImpl()
          Constructor.
 
Method Summary
 void configure(List<MasterToolContext> toolList, Set<String> osToolSet, String outDir)
          This method configures the tools that must be run on this machine by calling the configure method on each of the specified tools.
 void kill()
          Kills all the tools.
protected  LinkedHashMap<String,List<String>> parseOSToolSets()
          Obtains the OS toolsets.
 void postprocess()
          This method is responsible for post processing tools.
 boolean start(int delay)
          This method is responsible for starting all tools.
 boolean start(int delay, int duration)
          This method is responsible for starting all tools.
 boolean start(int delay, String[] t)
          Start only specified tools.
 boolean start(int delay, String[] t, int duration)
          Start only specified tools for specific duration.
 void stop()
          This method is responsible for stopping the tools.
 void stop(String[] t)
          Stopping specific tools.
 void unreferenced()
          When this instance is unreferenced the application must exit.
 void waitFor()
          Waits for all tools to finish up.
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, unexportObject
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toString, toStub
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ToolAgentImpl

public ToolAgentImpl()
              throws RemoteException
Constructor.

Throws:
RemoteException
Method Detail

configure

public void configure(List<MasterToolContext> toolList,
                      Set<String> osToolSet,
                      String outDir)
               throws IOException
This method configures the tools that must be run on this machine by calling the configure method on each of the specified tools.

Specified by:
configure in interface ToolAgent
Parameters:
toolList - - each element in the array is the name of a tool and optional arguments, e.g "sar -u -c"
osToolSet - list of os tools
outDir - output directory of the run
Throws:
IOException

start

public boolean start(int delay)
              throws RemoteException
This method is responsible for starting all tools.

Specified by:
start in interface ToolAgent
Parameters:
delay - - time to delay before starting
Returns:
true if all tools started successfully, else false
Throws:
RemoteException

start

public boolean start(int delay,
                     int duration)
              throws RemoteException
This method is responsible for starting all tools.

Specified by:
start in interface ToolAgent
Parameters:
delay - - time to delay before starting
duration - after which tools must be stopped
Returns:
true if all tools started successfully, else false
Throws:
RemoteException

start

public boolean start(int delay,
                     String[] t)
              throws RemoteException
Start only specified tools.

Specified by:
start in interface ToolAgent
Parameters:
delay - - time to delay before starting
t - - specific list of tools to start
Returns:
true if all tools are started successfully, false otherwise
Throws:
RemoteException - A communication error occurred

start

public boolean start(int delay,
                     String[] t,
                     int duration)
              throws RemoteException
Start only specified tools for specific duration.

Specified by:
start in interface ToolAgent
Parameters:
delay - - time to delay before starting
t - - specific list of tools to start
duration - after which tools must be stopped
Returns:
true if all tools are started successfully, false otherwise
Throws:
RemoteException - A communication error occurred

stop

public void stop()
This method is responsible for stopping the tools.

Specified by:
stop in interface ToolAgent

stop

public void stop(String[] t)
Stopping specific tools.

Specified by:
stop in interface ToolAgent
Parameters:
t - The tools to stop.

postprocess

public void postprocess()
This method is responsible for post processing tools.

Specified by:
postprocess in interface ToolAgent

waitFor

public void waitFor()
Waits for all tools to finish up.

Specified by:
waitFor in interface ToolAgent

kill

public void kill()
Kills all the tools.

Specified by:
kill in interface ToolAgent

unreferenced

public void unreferenced()
When this instance is unreferenced the application must exit.

Specified by:
unreferenced in interface Unreferenced
See Also:
Unreferenced

parseOSToolSets

protected LinkedHashMap<String,List<String>> parseOSToolSets()
Obtains the OS toolsets.

Returns:
LinkedHashMap