com.ibm.java.diagnostics.healthcenter.api.factory

Class HealthCenterFactory

  • java.lang.Object
    • com.ibm.java.diagnostics.healthcenter.api.factory.HealthCenterFactory


  • public class HealthCenterFactory
    extends java.lang.Object
    This is entry point into the Health Center API code. From here, you can either load a previously saved file, or connect to a running application that has the Health Center agent attached to it. By default, the Health Center agent listens on port 1972.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static HealthCenter connect()
      Make a connection to the current process, i.e.
      static HealthCenter connect(ConnectionProperties props)
      Connects to and monitors a running application that was started with the Health Center agent attached.
      static HealthCenter connect(ConnectionProperties props, boolean autoScan)
      Connects to and monitors a running application that was started with the Health Center agent attached.
      static HealthCenter connect(ConnectionProperties props, java.lang.String agentName)
      Connects to and monitors a running application that was started with the named Health Center agent attached.
      static HealthCenter connect(java.io.File filename)
      Loads a previously created Health Center .hcd file.
      static java.lang.String[] scanForAgents(ConnectionProperties props, int numberOfAgents)
      This method returns the names of the available agents that are running on a specific connection and is mainly used when searching for multiple agents that are all connected to a single MQTT broker.
      static int[] scanForPort(ConnectionProperties props, int numberOfScans, boolean stopWhenFound)
      This method scans a group of ports for available agents that are running.
      static void setMemoryRestictionEnabled(boolean enableMemoryRestriction)
      Sets whether to set memory restriction on or off.
      static void setMemoryRestrictionSize(long userMemoryRestrictionSize)
      Sets the maximum amount of memory to be used by the Health Center process when connecting a .hcd file.
      • Methods inherited from class java.lang.Object

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

      • HealthCenterFactory

        public HealthCenterFactory()
    • Method Detail

      • connect

        public static HealthCenter connect(java.io.File filename)
                                    throws HealthCenterException,
                                           java.io.FileNotFoundException
        Loads a previously created Health Center .hcd file. This will not return until the file has been completely loaded. This ensures that all the data has been loaded and processed. Note. Memory restrictions are disabled when loading an hcd file
        Parameters:
        filename - - the file to load.
        Returns:
        a HealthCenter object, which provides access to all the data in the specified file.
        Throws:
        HealthCenterException
        java.io.FileNotFoundException
      • scanForPort

        public static int[] scanForPort(ConnectionProperties props,
                                        int numberOfScans,
                                        boolean stopWhenFound)
                                 throws HealthCenterException
        This method scans a group of ports for available agents that are running.
        Parameters:
        props - this object contains information such as the host to search and the starting port.
        numberOfScans - the number of ports to scan. The more scans that are made, the longer this process takes.
        stopWhenFound - setting this to true stops the scan after the first agent is found.
        Returns:
        an int array, representing ports that have Health Center agents listening on.
        Throws:
        HealthCenterException
      • scanForAgents

        public static java.lang.String[] scanForAgents(ConnectionProperties props,
                                                       int numberOfAgents)
                                                throws HealthCenterException
        This method returns the names of the available agents that are running on a specific connection and is mainly used when searching for multiple agents that are all connected to a single MQTT broker.
        Parameters:
        props - this object contains the hostname and port to search on
        numberOfAgents - the maximum number of agent names to return but you will get less if fewer agents are available. The larger the number, the longer this process takes. To bring back all agent names, enter 0.
        Returns:
        a String array, representing the names of the HealthCenter agents discovered.
        Throws:
        HealthCenterException
      • setMemoryRestrictionSize

        public static void setMemoryRestrictionSize(long userMemoryRestrictionSize)
        Sets the maximum amount of memory to be used by the Health Center process when connecting a .hcd file. This method must be called before connecting to the file to ensure the memory restriction is set as requested. If not called before connecting or if the value is not larger than the default of 200mb then the default is used instead.
        Parameters:
        userMemoryRestrictionSize - - the value of the memory to use, in bytes.
      • setMemoryRestictionEnabled

        public static void setMemoryRestictionEnabled(boolean enableMemoryRestriction)
        Sets whether to set memory restriction on or off. The default is ON. This value makes the Health Center process restrict the amount of memory that it uses.
        Parameters:
        enableMemoryRestriction - true or false
© Copyright 2012, 2016 IBM Corporation.