org.jlf.vitals
Class VitalsCaptureProcessor

java.lang.Object
  |
  +--org.jlf.vitals.VitalsCaptureProcessor
All Implemented Interfaces:
java.lang.Runnable

public class VitalsCaptureProcessor
extends java.lang.Object
implements java.lang.Runnable

The VitalsCaptureThread class, every second or so, runs through all the vitals that should be collected periodically and captures a measurement on each vital sign that needs to be collected.


Field Summary
protected  java.util.Collection cachedVitals
          Caches a set of vital signs to capture, so as to not lock up the vitals manager's collection of them.
protected  long cachedVitalsUsed
          Number of times the processor used the cached copy of periodic vitals.
protected  java.lang.Thread captureThread
          Holds the thread capturing vitals.
protected static VitalsCaptureProcessor singleton
          Holds the current singleton instance of the class.
protected  boolean stopThread
          This flag could be changed to stop the thread from capturing any more resources.
protected static long threadNumber
          The unique identifier for the thread.
 
Constructor Summary
protected VitalsCaptureProcessor()
          Default constructor, starts a thread capturing vitals.
 
Method Summary
protected  void collectMeasurements()
          Runs through a set of cached vitals and collect a current measurement on each of them.
protected  java.lang.Thread createCaptureThread()
          Helper method to create a thread that runs this class to capture vitals.
protected  java.util.Collection getCachedVitals()
          Manages the cached vitals variable, getting a collection from the vitals manager and refreshing it every so often.
static VitalsCaptureProcessor getInstance()
          Gets the current thread responsible for capturing vitals.
 boolean isCapturingVitals()
          Tells if the current vitals capture processor thread is set to capture vitals.
 void run()
          Main method to collect measurements.
protected  void setStopThread(boolean stopThreadFlag)
          Sets the stopThread flag to stop the thread next time through its run loop, to be used when the thread is no longer needed.
 void startCapturingVitals()
          Starts a new thread (stopping any current thread first) to capture vitals.
 void stopCapturingVitals()
          Stops the current thread from capturing vitals.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

singleton

protected static VitalsCaptureProcessor singleton
Holds the current singleton instance of the class.


threadNumber

protected static long threadNumber
The unique identifier for the thread.


captureThread

protected java.lang.Thread captureThread
Holds the thread capturing vitals.


stopThread

protected boolean stopThread
This flag could be changed to stop the thread from capturing any more resources.


cachedVitals

protected java.util.Collection cachedVitals
Caches a set of vital signs to capture, so as to not lock up the vitals manager's collection of them.


cachedVitalsUsed

protected long cachedVitalsUsed
Number of times the processor used the cached copy of periodic vitals.

Constructor Detail

VitalsCaptureProcessor

protected VitalsCaptureProcessor()
Default constructor, starts a thread capturing vitals.

Method Detail

getInstance

public static VitalsCaptureProcessor getInstance()
Gets the current thread responsible for capturing vitals.


createCaptureThread

protected java.lang.Thread createCaptureThread()
Helper method to create a thread that runs this class to capture vitals.


setStopThread

protected void setStopThread(boolean stopThreadFlag)
Sets the stopThread flag to stop the thread next time through its run loop, to be used when the thread is no longer needed.


stopCapturingVitals

public void stopCapturingVitals()
Stops the current thread from capturing vitals.


startCapturingVitals

public void startCapturingVitals()
Starts a new thread (stopping any current thread first) to capture vitals.


isCapturingVitals

public boolean isCapturingVitals()
Tells if the current vitals capture processor thread is set to capture vitals.


getCachedVitals

protected java.util.Collection getCachedVitals()
Manages the cached vitals variable, getting a collection from the vitals manager and refreshing it every so often.


collectMeasurements

protected void collectMeasurements()
Runs through a set of cached vitals and collect a current measurement on each of them.


run

public void run()
Main method to collect measurements.

Specified by:
run in interface java.lang.Runnable