xmlBlaster 2.2.0 API

org.xmlBlaster.engine.cluster
Class NodeStateInfo

java.lang.Object
  extended by org.xmlBlaster.engine.cluster.NodeStateInfo

public class NodeStateInfo
extends java.lang.Object

Holds performance data of a node.

This is a demo code only, we need to change it to handle some performance index which is comparable between different nodes.

 <!-- Messages of type "__sys__cluster.node.master[heron]": -->
 <state>
   <cpu id='0' idle='40'/>   <!-- currently 60% load on first CPU -->
   <cpu id='1' idle='44'/>
   <ram free='12000'/>       <!-- xmlBlaster server has 12 MB free memory -->
   <performance bogomips='1205.86' idleIndex='20'/>
 </master>
 


Nested Class Summary
(package private)  class NodeStateInfo.Cpu
           
 
Field Summary
private  int avgCpuIdle
          Average idle of all CPUs of the node, -1 if not known
private  java.util.Map cpuMap
          Holds Cpu info objects, the key is the 'id'
private  int freeRam
          Free RAM memory in kBytes, -1 if not known
private static java.util.logging.Logger log
           
 
Constructor Summary
NodeStateInfo(Global global)
           
 
Method Summary
 void endElement(java.lang.String uri, java.lang.String localName, java.lang.String name, java.lang.StringBuffer character)
          Handle SAX parsed end element
 int getAvgCpuIdle()
           
 int getFreeRam()
           
 void setCpu(int id, int idle)
          Add or change the current CPU idle value
 void setFreeRam(int freeRam)
          Free RAM memory in kBytes
 boolean startElement(java.lang.String uri, java.lang.String localName, java.lang.String name, java.lang.StringBuffer character, org.xml.sax.Attributes attrs)
          Called for SAX master start tag
 java.lang.String toXml()
          Dump state of this object into a XML ASCII string.
 java.lang.String toXml(java.lang.String extraOffset)
          Dump state of this object into a XML ASCII string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static java.util.logging.Logger log

freeRam

private int freeRam
Free RAM memory in kBytes, -1 if not known


cpuMap

private java.util.Map cpuMap
Holds Cpu info objects, the key is the 'id'


avgCpuIdle

private int avgCpuIdle
Average idle of all CPUs of the node, -1 if not known

Constructor Detail

NodeStateInfo

public NodeStateInfo(Global global)
Method Detail

getFreeRam

public int getFreeRam()
Returns:
Free RAM memory in kBytes

setFreeRam

public void setFreeRam(int freeRam)
Free RAM memory in kBytes


getAvgCpuIdle

public int getAvgCpuIdle()
Returns:
Average idle of all CPUs of the node in percent, e.g. 40 is 40% idle

setCpu

public void setCpu(int id,
                   int idle)
Add or change the current CPU idle value


startElement

public final boolean startElement(java.lang.String uri,
                                  java.lang.String localName,
                                  java.lang.String name,
                                  java.lang.StringBuffer character,
                                  org.xml.sax.Attributes attrs)
Called for SAX master start tag

Returns:
true if ok, false on error

endElement

public final void endElement(java.lang.String uri,
                             java.lang.String localName,
                             java.lang.String name,
                             java.lang.StringBuffer character)
Handle SAX parsed end element


toXml

public final java.lang.String toXml()
Dump state of this object into a XML ASCII string.


toXml

public final java.lang.String toXml(java.lang.String extraOffset)
Dump state of this object into a XML ASCII string.

Parameters:
extraOffset - indenting of tags for nice output

xmlBlaster 2.2.0 API

Copyright © 1999-2014 The xmlBlaster.org contributers.