ilog.rules.monitor

Class IlrMonitorLocalTool



  • public final class IlrMonitorLocalTool
    extends IlrMonitorTool
    Monitoring tool that instanciate a listener thread that builds a thread contention model at regular intervals, and authorize to get it in different serialized format.

     IlrMonitorLocalTool tool = new IlrMonitorLocalTool(20, 10L);
     tool.launch();
     // Code to monitor ....
     tool.printXmlLogInFile("monitor.xml");
     
    Since:
    JRules 7.0
    See Also:
    IlrJMXLocalThreadMonitor
    • Constructor Summary

      Constructors 
      Constructor and Description
      IlrMonitorLocalTool(int depth, long intervalMs)
      Constructs the tool with a capability to build the model with a depth of stack trace, and with a given interval of monitoring.
      IlrMonitorLocalTool(int depth, long intervalMs, java.util.EnumSet<java.lang.Thread.State> threadStates)
      Constructs the tool with a capability to build the model with a depth of stack trace, and with a given interval of monitoring.
      IlrMonitorLocalTool(int depth, long intervalMs, java.util.EnumSet<java.lang.Thread.State> threadStates, long[] excludedThreadIds)
      Constructs the tool with a capability to build the model with a depth of stack trace, and with a given interval of monitoring.
    • Method Summary

      Methods 
      Modifier and Type Method and Description
      org.w3c.dom.Document getXMLModel()
      Returns an instance of org.w3c.dom.Document that represents the model of thread contention.
      void launch()
      Calls to this method launch the listener thread and so begins monitoring.
      void print(java.io.PrintWriter writer, IlrStackElementFilter filter, boolean xmlFormat)
      Prints the model in a serialize format inside a given PrintWriter.
      • Methods inherited from class java.lang.Object

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

      • IlrMonitorLocalTool

        public IlrMonitorLocalTool(int depth,
                           long intervalMs)
        Constructs the tool with a capability to build the model with a depth of stack trace, and with a given interval of monitoring. A snapshot will add information inside the model if thread contention is detected. Only contention of type BLOCKED will be detected java.lang.Thread.State.BLOCKED.

        Equivalent to call IlrMonitoringLocalTool(depth, intervals, EnumSet.of(Thread.State.BLOCKED))

        Parameters:
        depth - value of stack trace depth. It means the number of stack elements in a stack trace.
        intervalMs - interval in milliseconds between two snapshots
      • IlrMonitorLocalTool

        public IlrMonitorLocalTool(int depth,
                           long intervalMs,
                           java.util.EnumSet<java.lang.Thread.State> threadStates)
        Constructs the tool with a capability to build the model with a depth of stack trace, and with a given interval of monitoring. A snapshot will add information inside the model if thread contention is detected. Only thread whose state is contained in the EnumSet given will add information in the model built.

        Equivalent to call IlrMonitoringLocalTool(depth, intervals, threadStates, null)

        Parameters:
        depth - value of stack trace depth. It means the number of stack elements in a stack trace.
        intervalMs - interval in milliseconds between two snapshots
        threadStates - EnumSet of thread state that should be monitored.
      • IlrMonitorLocalTool

        public IlrMonitorLocalTool(int depth,
                           long intervalMs,
                           java.util.EnumSet<java.lang.Thread.State> threadStates,
                           long[] excludedThreadIds)
        Constructs the tool with a capability to build the model with a depth of stack trace, and with a given interval of monitoring. A snapshot will add information inside the model if thread contention is detected. Only thread whose state is contained in the EnumSet and whose id is not contained inside the excluded thread ids long array given will add information in the model built.
        Parameters:
        depth - value of stack trace depth. It means the number of stack elements in a stack trace.
        intervalMs - interval in milliseconds between two snapshots
        threadStates - EnumSet of thread state that should be monitored.
        excludedThreadIds - array of long of thread ids that shouldn't be monitored.
    • Method Detail

      • launch

        public void launch()
        Calls to this method launch the listener thread and so begins monitoring. It could be called several times after a call to print method if needed. But the model will be reset.
        Specified by:
        launch in class IlrMonitorTool
      • print

        public void print(java.io.PrintWriter writer,
                 IlrStackElementFilter filter,
                 boolean xmlFormat)
        Prints the model in a serialize format inside a given PrintWriter. Calls to this method stops the listener thread.
        Specified by:
        print in class IlrMonitorTool
        Parameters:
        writer - a instance of PrintWriter
        filter - instance of IlrStackElementFilter. Could be null.
        xmlFormat - true if XML format serialization is wanted.
      • getXMLModel

        public org.w3c.dom.Document getXMLModel()
        Returns an instance of org.w3c.dom.Document that represents the model of thread contention. Calls to this methods will stop the listener thread.
        Specified by:
        getXMLModel in class IlrMonitorTool
        Returns:
        the XML DOM Document of the thread contention model.

© Copyright IBM Corp. 1987, 2017