Class SystemMonitor

java.lang.Object
org.jpos.util.SystemMonitor
All Implemented Interfaces:
Runnable, Loggeable, LogSource

public class SystemMonitor extends Object implements Runnable, LogSource, Loggeable
Periodically dumps Thread and memory usage
See Also:
  • Constructor Details

    • SystemMonitor

      public SystemMonitor()
      noargs constructor
    • SystemMonitor

      public SystemMonitor(int sleepTime, Logger logger, String realm)
      Constructs a monitor with the given polling interval and logger binding.
      Parameters:
      sleepTime - sleep
      logger - current logger
      realm - instance realm
  • Method Details

    • setSleepTime

      public void setSleepTime(int sleepTime)
      Sets the polling interval and (re)starts the monitor thread.
      Parameters:
      sleepTime - new sleepTime;
    • showThreadGroup

      public void showThreadGroup(ThreadGroup g, PrintStream p, String indent)
      Recursively dumps g and every parent thread group, with their threads.
      Parameters:
      g - starting thread group
      p - destination stream
      indent - prefix used for indentation
    • run

      public void run()
      Specified by:
      run in interface Runnable
    • shutdown

      public void shutdown()
      Signals the monitor's run loop to terminate.
    • dump

      public void dump(PrintStream p, String indent)
      Description copied from interface: Loggeable
      Dumps a human-readable representation of this object to the print stream.
      Specified by:
      dump in interface Loggeable
      Parameters:
      p - the output stream
      indent - indentation prefix
    • setLogger

      public void setLogger(Logger logger, String realm)
      Description copied from interface: LogSource
      Attaches a Logger and realm to this log source.
      Specified by:
      setLogger in interface LogSource
      Parameters:
      logger - the logger to use
      realm - the log realm (diagnostic label)
    • getRealm

      public String getRealm()
      Description copied from interface: LogSource
      Returns the log realm associated with this source.
      Specified by:
      getRealm in interface LogSource
      Returns:
      log realm
    • getLogger

      public Logger getLogger()
      Description copied from interface: LogSource
      Returns the Logger associated with this source.
      Specified by:
      getLogger in interface LogSource
      Returns:
      the Logger