Class JMSStatus

  • All Implemented Interfaces:
    JMSStatusMBean

    public final class JMSStatus
    extends Object
    implements JMSStatusMBean
    Root component managing all JMS connector healthcheck components.
    • Constructor Detail

      • JMSStatus

        public JMSStatus​(String name,
                         int period,
                         int timeout,
                         String dumpFilePath,
                         int threshold,
                         int delay)
        Creates a JMS connectors healthcheck root component.
        Parameters:
        name - Name of component, used to define the domain of the JMX MBeans.
        period - Default period of activation for checks (seconds).
        timeout - Default timeout for checks (seconds).
        dumpFilePath - Pathname for server dump, the current time is aggregated at the end of the file name.
        threshold - Number of consecutive failures needed to trigger a dump.
        delay - Minimal delay between 2 dumps (seconds).
    • Method Detail

      • getStatus

        public int getStatus()
        Description copied from interface: JMSStatusMBean
        Returns the global healthcheck indication, 0 if all connectors are running, 1 otherwise.
        Specified by:
        getStatus in interface JMSStatusMBean
        Returns:
        the global healthcheck indication.
      • getStatusInfo

        public String getStatusInfo()
        Description copied from interface: JMSStatusMBean
        Returns a user friendly indication of the global healthcheck: RUNNING or UNREACHABLE.
        Specified by:
        getStatusInfo in interface JMSStatusMBean
        Returns:
        a user friendly indication of the global healthcheck
      • getPeriod

        public int getPeriod()
        Description copied from interface: JMSStatusMBean
        Returns the activation period in seconds.
        Specified by:
        getPeriod in interface JMSStatusMBean
        Returns:
        the activation period in seconds.
      • setPeriod

        public void setPeriod​(int period)
        Description copied from interface: JMSStatusMBean
        Sets the activation period in seconds.
        Specified by:
        setPeriod in interface JMSStatusMBean
        Parameters:
        period - the activation period in seconds.
      • getTimeout

        public int getTimeout()
        Description copied from interface: JMSStatusMBean
        Returns the timeout used during check.
        Specified by:
        getTimeout in interface JMSStatusMBean
        Returns:
        the timeout used during check.
      • setTimeout

        public void setTimeout​(int timeout)
        Description copied from interface: JMSStatusMBean
        Sets the timeout used during check.
        Specified by:
        setTimeout in interface JMSStatusMBean
        Parameters:
        timeout - the timeout used during check.
      • getThreshold

        public int getThreshold()
        Description copied from interface: JMSStatusMBean
        Returns the minimum number of failures before generating a dump.
        Specified by:
        getThreshold in interface JMSStatusMBean
        Returns:
        the minimum number of failures before generating a dump.
      • setThreshold

        public void setThreshold​(int threshold)
        Description copied from interface: JMSStatusMBean
        Sets the minimum number of failures before generating a dump.
        Specified by:
        setThreshold in interface JMSStatusMBean
        Parameters:
        threshold - the minimum number of failures before generating a dump.
      • getDelay

        public int getDelay()
        Description copied from interface: JMSStatusMBean
        Returns the minimal delay between 2 dumps.
        Specified by:
        getDelay in interface JMSStatusMBean
        Returns:
        the minimal delay between 2 dumps.
      • setDelay

        public void setDelay​(int delay)
        Description copied from interface: JMSStatusMBean
        Sets the minimal delay between 2 dumps.
        Specified by:
        setDelay in interface JMSStatusMBean
        Parameters:
        delay - the minimal delay between 2 dumps.
      • addConnectorStatus

        public void addConnectorStatus​(String cfname,
                                       InitialContext ictx,
                                       String user,
                                       String pass,
                                       String qname,
                                       int period,
                                       int timeout)
        Adds an healthcheck for the specified JMS connector.
        Parameters:
        cfname - JNDI name of the ConnectionFactory to use.
        ictx - JNDI context allowing to retrieve ConnectionFactory.
        user - User name for authentication, if no defined uses the ConnectionFactory default.
        pass - Password for authentication, if no defined uses the ConnectionFactory default.
        qname - Internal name of JMS destination.
        period - Period between 2 checks, by default 60s.
        timeout - Maximum amount of time to wait connecting and receiving messages, by default 10s.
      • checkDump

        static void checkDump​(String name,
                              int retry)
      • getInitialContext

        InitialContext getInitialContext​(String jndiFile,
                                         String jndiFactory,
                                         String jndiHost,
                                         String jndiPort)
                                  throws IOException,
                                         NamingException
        Creates the JNDI context to use.
        Parameters:
        jndiFile - Path of JNDI properties file. If not defined, Joram's default are used. "fr.dyade.aaa.jndi2.client.NamingContextFactory" for JNDI Factory, "localhost", and 16400 for host and port. These values can be overloaded by specific properties below.
        jndiFactory - Classname of the JNDI factory (see "java.naming.factory.initial" property).
        jndiHost - Hostname ou IP address of JNDI server.
        jndiPort - Listening port of JNDI server.
        Returns:
        Throws:
        IOException
        NamingException
      • registerMBean

        void registerMBean()
      • unregisterMBean

        void unregisterMBean()
      • dumpServerState

        public void dumpServerState​(String path)
        Description copied from interface: JMSStatusMBean
        Generates a server dump.
        Specified by:
        dumpServerState in interface JMSStatusMBean
        Parameters:
        path - Pathname of file to create.
      • dumpServerState

        static void dumpServerState​(String path,
                                    String cause)