Bees v0.5.0 API

apps.health
Class NodeHealth

java.lang.Object
  |
  +--apps.health.NodeHealth
All Implemented Interfaces:
edu.utah.janosvm.kit.comm.jsi.JSIHandler, NodeCache.EventHandler
Direct Known Subclasses:
SimpleNodeHealth

public class NodeHealth
extends java.lang.Object
implements NodeCache.EventHandler, edu.utah.janosvm.kit.comm.jsi.JSIHandler

A NodeHealth object is used to store the health state of a node in the network. The implementation of this class only maintains coarse grained state, however, it should be simple enough to extend if more detail needs to be transmitted.


Field Summary
protected  int state
          The health state of the node.
static int STATE_ASSUMED_OK
          The node is assumed to be ok, there hasn't been a recent report, but its not long enough to start worrying.
static int STATE_FINE
          The node is fine, all sensors are within limits.
static int STATE_MAX
          The maximum state value.
static int STATE_MIN
          The minimum state value.
static java.lang.String[] STATE_NAMES
          The human readable names of the state values.
static int STATE_OFF
          The node is turned off, don't expect any reports.
static int STATE_ON_FIRE
          The node is not alright, one or more sensors are outside acceptable limits.
static int STATE_UNKNOWN
          The node state cannot be polled.
static int STATE_UNREACHABLE
          The node is unreachable through the network.
 
Constructor Summary
NodeHealth(java.lang.String name)
          Construct a NodeHealth object with the given values.
 
Method Summary
 IntegerPermission collected(Node node, ProtocolSession ps)
          This is called when this element is up for collection, the return value specifies the new expiration time.
 java.lang.String getName()
           
 int getState()
           
 void getSuites(edu.utah.janosvm.kit.comm.jsi.JSIMessage jm)
           
 void handleMessage(edu.utah.janosvm.kit.comm.jsi.JSIHandlerContext jhc, edu.utah.janosvm.kit.comm.jsi.JSIMessage jm)
           
 void marshal(XdrByteArray xba)
           
 int marshalledLength()
           
 IntegerPermission poll(HealthSession hs)
          Poll the node's health and update this object's state.
 void removed(Node node, ProtocolSession ps)
          This is called when the element is manually removed from from the cache.
 edu.utah.janosvm.kit.comm.jsi.JSIHandler resolveSpecifier(edu.utah.janosvm.kit.comm.jsi.JSIMessage jm, edu.utah.janosvm.kit.comm.jsi.JSIPair jp)
           
 void setState(int state)
           
 java.lang.String toString()
           
 void unmarshal(XdrByteArray xba)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

STATE_MIN

public static final int STATE_MIN
The minimum state value.

STATE_FINE

public static final int STATE_FINE
The node is fine, all sensors are within limits.

STATE_ON_FIRE

public static final int STATE_ON_FIRE
The node is not alright, one or more sensors are outside acceptable limits.

STATE_ASSUMED_OK

public static final int STATE_ASSUMED_OK
The node is assumed to be ok, there hasn't been a recent report, but its not long enough to start worrying.

STATE_UNKNOWN

public static final int STATE_UNKNOWN
The node state cannot be polled.

STATE_UNREACHABLE

public static final int STATE_UNREACHABLE
The node is unreachable through the network.

STATE_OFF

public static final int STATE_OFF
The node is turned off, don't expect any reports.

STATE_MAX

public static final int STATE_MAX
The maximum state value.

STATE_NAMES

public static final java.lang.String[] STATE_NAMES
The human readable names of the state values.

state

protected int state
The health state of the node.
Constructor Detail

NodeHealth

public NodeHealth(java.lang.String name)
Construct a NodeHealth object with the given values.
Parameters:
name - The name of the node this health information pertains to.
Method Detail

getName

public java.lang.String getName()
Returns:
The name of the node this health information pertains to.

setState

public void setState(int state)
Parameters:
state - The health state of the node.

getState

public int getState()
Returns:
The health state of the node.

marshalledLength

public int marshalledLength()

marshal

public void marshal(XdrByteArray xba)

unmarshal

public void unmarshal(XdrByteArray xba)

poll

public IntegerPermission poll(HealthSession hs)
Poll the node's health and update this object's state. This is a dummy implementation it will always set the state to STATE_UNKNOWN and return the poll frequency permission.
Parameters:
hs - The HealthSession for the current flow.
Returns:
An IntegerPermission containing the millisecond delay to the next polling interval.

removed

public void removed(Node node,
                    ProtocolSession ps)
Description copied from interface: NodeCache.EventHandler
This is called when the element is manually removed from from the cache.
Specified by:
removed in interface NodeCache.EventHandler
See Also:
NodeCache.EventHandler.removed(Node, ProtocolSession)

collected

public IntegerPermission collected(Node node,
                                   ProtocolSession ps)
Description copied from interface: NodeCache.EventHandler
This is called when this element is up for collection, the return value specifies the new expiration time. Null is returned if the element should really be collected.
Specified by:
collected in interface NodeCache.EventHandler
See Also:
NodeCache.EventHandler.collected(Node, ProtocolSession)

resolveSpecifier

public edu.utah.janosvm.kit.comm.jsi.JSIHandler resolveSpecifier(edu.utah.janosvm.kit.comm.jsi.JSIMessage jm,
                                                                 edu.utah.janosvm.kit.comm.jsi.JSIPair jp)
Specified by:
resolveSpecifier in interface edu.utah.janosvm.kit.comm.jsi.JSIHandler
See Also:
JSIHandler.resolveSpecifier(JSIMessage, JSIPair)

handleMessage

public void handleMessage(edu.utah.janosvm.kit.comm.jsi.JSIHandlerContext jhc,
                          edu.utah.janosvm.kit.comm.jsi.JSIMessage jm)
Specified by:
handleMessage in interface edu.utah.janosvm.kit.comm.jsi.JSIHandler
See Also:
JSIHandler.handleMessage(JSIHandlerContext, JSIMessage)

getSuites

public void getSuites(edu.utah.janosvm.kit.comm.jsi.JSIMessage jm)
Specified by:
getSuites in interface edu.utah.janosvm.kit.comm.jsi.JSIHandler
See Also:
JSIHandler.getSuites(JSIMessage)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
See Also:
Object.toString()

Bees v0.5.0 API

This documentation is Copyright (C) 2002 The University of Utah. All Rights Reserved. See the individual source files for distribution terms.
Documentation, software, and mailing lists for Bees v0.5.0 can be found at the Janos Project: http://www.cs.utah.edu/flux/janos/