Class SolarisProbe

  • All Implemented Interfaces:
    java.lang.Runnable

    public class SolarisProbe
    extends java.lang.Object
    implements java.lang.Runnable
    Probe for Solaris, designed to produce a variety of system usage measures as a single, background activity, and shared by CLIF probes of several kinds, namely cpu and memory as of current version. This probe is based on the following command lines to get measures:
    • "swap -s" to get the total amount of swap configured for the system
    • "prtconf" to get the total RAM installed in the system
    • "vmstat 1" to get RAM and swap usage every second.
    This probe shall be used as a singleton, and preferably getting measures each second, because the singleton produces 1 measure per second and does not buffer, nor aggregate, measures in case they are not queried (they are simply discarded).
    Author:
    Bruno Dillenseger
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      long[] getData()
      Gets the latest measures from the resource usage polling process.
      static SolarisProbe getSingleton()
      Gets the SolarisProbe singleton, creating a new one when the client counter is zero.
      void run()
      Resource usage polling activity.
      void stop()
      Decreases the number of clients for this SolarisProbe, and stops the resource usage polling process when the client counter becomes zero.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getSingleton

        public static SolarisProbe getSingleton()
                                         throws java.lang.Exception
        Gets the SolarisProbe singleton, creating a new one when the client counter is zero.
        Returns:
        the SolarisProbe singleton
        Throws:
        java.lang.Exception - the singleton could not be created.
        See Also:
        clientCount, SolarisProbe()
      • getData

        public long[] getData()
        Gets the latest measures from the resource usage polling process.
        Returns:
        an array of long with the following values (in this order):
        • total memory kB
        • free memory kB
        • total swap kB
        • free swap kB
        • user cpu %
        • sys cpu %
      • stop

        public void stop()
                  throws java.lang.InterruptedException
        Decreases the number of clients for this SolarisProbe, and stops the resource usage polling process when the client counter becomes zero.
        Throws:
        java.lang.InterruptedException
      • run

        public void run()
        Resource usage polling activity. Reads the output of command "vmstat 1" until boolean "stopped" becomes true.
        Specified by:
        run in interface java.lang.Runnable
        See Also:
        getSingleton(), stop()