com.sun.grid.loadsensor
Class LoadSensorManager

java.lang.Object
  extended by com.sun.grid.loadsensor.LoadSensorManager

public class LoadSensorManager
extends java.lang.Object

The LoadSensorManager implements the load sensor protocol. A load sensor can use this class either by instantiating an instance and passing in the LoadSensor implementation instance or by running the LoadSensorManager class directly and passing as an argument the name of the class to be run as the LoadSensor implementation. Once started, the LoadSensorManager instance reads the input from the load sensor framework from stdin and writes commands to stdout. The load sensor protocol is completely encapsulated, however, allowing the LoadSensor implementation to work at the level of name=value pairs for measured load values. The LoadSensorManager will monitor how often it is asked for load values and how long it takes to take a measurement. It will use that information to try to optimally schedule the next measurement. The idea is to run the measurement as late as possible but still have it complete before the next time load values are requested. Alternatively, the load sensor may specify its own measurement interval independent of when the load value requests are made. In that case, the measurements are made in a separate thread, and load value requests are given the last set of load values reported by the measurement thread. The LoadSensorManager class uses the Logger named "com.sun.grid.LoadSensor". By default, the Logger has no handlers installed. In order to enable logging, add a handler, i.e. a FileHandler instance. It is always a good idea to enabling logging, as errors in load sensor protocol handling will be logged as warnings, but will not be visible any other way.

Since:
6.2u5

Constructor Summary
LoadSensorManager(LoadSensor loadSensor)
          Create an instance for this load sensor.
 
Method Summary
static void main(java.lang.String[] args)
           
 void parse()
          Start the load sensor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LoadSensorManager

public LoadSensorManager(LoadSensor loadSensor)
Create an instance for this load sensor.

Parameters:
loadSensor - the load sensor to manage
Method Detail

main

public static void main(java.lang.String[] args)
Parameters:
args - the command line arguments

parse

public void parse()
           throws java.io.IOException
Start the load sensor. This method reads commands from the execution daemon and triggers appropriate actions on the managed load sensor. This method will not return until the input stream is closed or it reads "QUIT\n" from the stream.

Throws:
java.io.IOException - Thrown is there is an error communicating with the execution daemon