Class ModClusterListener

    • Constructor Detail

      • ModClusterListener

        public ModClusterListener()
    • Method Detail

      • lifecycleEvent

        public void lifecycleEvent​(org.apache.catalina.LifecycleEvent event)
        Specified by:
        lifecycleEvent in interface org.apache.catalina.LifecycleListener
      • setJvmRouteFactoryClass

        public void setJvmRouteFactoryClass​(Class<? extends JvmRouteFactory> factoryClass)
      • getLoadMetricClass

        public String getLoadMetricClass()
        Returns the class name of the configured load metric.
        Returns:
        the name of a class implementing LoadMetric
      • setLoadMetricClass

        public void setLoadMetricClass​(String loadMetricClass)
        Sets the class of the desired load metric
        Parameters:
        loadMetricClass - a class implementing LoadMetric
        Throws:
        IllegalArgumentException - if metric class could not be loaded
      • getLoadDecayFactor

        public float getLoadDecayFactor()
        Returns the factor by which the contribution of historical load values to the load factor calculation should exponentially decay.
        Returns:
        the configured load decay factor
      • setLoadDecayFactor

        public void setLoadDecayFactor​(float decayFactor)
        Sets the factor by which the contribution of historical load values to the load factor calculation should exponentially decay.
        Parameters:
        decayFactor - a positive number
      • setLoadDecayFactor

        public void setLoadDecayFactor​(String decayFactor)
        String-based variant of setLoadDecayFactor(float) to set float decay factor used by Tomcat modeler.
        Parameters:
        decayFactor - a positive number
      • getLoadHistory

        public int getLoadHistory()
        Returns the number of historic load values used when calculating the load factor.
        Returns:
        the configured load history
      • setLoadHistory

        public void setLoadHistory​(int history)
        Sets the number of historic load values used when calculating the load factor.
        Parameters:
        history -
      • getLoadMetricCapacity

        public double getLoadMetricCapacity()
      • setLoadMetricCapacity

        public void setLoadMetricCapacity​(String capacity)
        Sets the capacity (i.e. maximum expected value) of the load values returned by the load metric specified by getLoadMetricClass()
        Parameters:
        capacity - a load capacity
      • getInitialLoad

        public int getInitialLoad()
      • setInitialLoad

        public void setInitialLoad​(int initialLoad)
      • addProxy

        public void addProxy​(String host,
                             int port)
        Description copied from interface: ModClusterServiceMBean
        Add a proxy to the list of those with which this handler communicates. Communication does not begin until the next call to MCMPHandler.status().
        Specified by:
        addProxy in interface ModClusterServiceMBean
        Parameters:
        host - the hostname of the proxy; a string suitable for passing to InetAddress.getByHost(...)
        port - the port on which the proxy listens for MCMP requests
      • disable

        public boolean disable()
        Description copied from interface: ModClusterServiceMBean
        Disable all webapps for all engines.
        Specified by:
        disable in interface ModClusterServiceMBean
        Returns:
        true, if all proxies are responding normally, false otherwise
      • disableContext

        public boolean disableContext​(String hostName,
                                      String contextPath)
        Description copied from interface: ModClusterServiceMBean
        Disables the webapp with the specified host and context path.
        Specified by:
        disableContext in interface ModClusterServiceMBean
        Parameters:
        hostName - host name of the target webapp
        contextPath - context path of the target webapp
        Returns:
        true, if all proxies are responding normally, false otherwise
      • ping

        public Map<InetSocketAddress,​String> ping​(String jvmRoute)
        Description copied from interface: ModClusterServiceMBean
        Ping a node from httpd. returning the PING_RSP grouped by proxy address. determines whether the node configured with the specified jvm route is accessible from each proxy returning the PING_RSP grouped by proxy address.
        Specified by:
        ping in interface ModClusterServiceMBean
        Parameters:
        jvmRoute - a jvm route.
        Returns:
        a map of PING_RSP responses, grouped by proxy
      • ping

        public Map<InetSocketAddress,​String> ping​(String scheme,
                                                        String host,
                                                        int port)
        Description copied from interface: ModClusterServiceMBean
        Ping a node defined protocol, host and port from httpd. determines whether a node (not necessarily configured) with the matching connector is accessible from each proxy
        Specified by:
        ping in interface ModClusterServiceMBean
        Parameters:
        scheme - ajp, http or https
        host - name or IP of a the host
        Returns:
        a map of PING_RSP responses, grouped by proxy
      • enable

        public boolean enable()
        Description copied from interface: ModClusterServiceMBean
        Enable all webapps for all engines.
        Specified by:
        enable in interface ModClusterServiceMBean
        Returns:
        true, if all proxies are responding normally, false otherwise
      • enableContext

        public boolean enableContext​(String hostName,
                                     String contextPath)
        Description copied from interface: ModClusterServiceMBean
        Enables the webapp with the specified host and context path.
        Specified by:
        enableContext in interface ModClusterServiceMBean
        Parameters:
        hostName - host name of the target webapp
        contextPath - context path of the target webapp
        Returns:
        true, if all proxies are responding normally, false otherwise
      • getProxyConfiguration

        public Map<InetSocketAddress,​String> getProxyConfiguration()
        Description copied from interface: ModClusterServiceMBean
        Retrieves the full proxy configuration. response: node: [1:1] JVMRoute: node1 Domain: [bla] Host: 127.0.0.1 Port: 8009 Type: ajp host: 1 [] vhost: 1 node: 1 context: 1 [/] vhost: 1 node: 1 status: 1 context: 2 [/myapp] vhost: 1 node: 1 status: 1 context: 3 [/host-manager] vhost: 1 node: 1 status: 1 context: 4 [/docs] vhost: 1 node: 1 status: 1 context: 5 [/manager] vhost: 1 node: 1 status: 1 Sends a DUMP request to all proxies, returning the responses grouped by proxy address.
        Specified by:
        getProxyConfiguration in interface ModClusterServiceMBean
        Returns:
        a map of DUMP_RSP responses, grouped by proxy
      • removeProxy

        public void removeProxy​(String host,
                                int port)
        Description copied from interface: ModClusterServiceMBean
        Remove a proxy from the list of those with which this handler communicates. Communication does not end until the next call to MCMPHandler.status().
        Specified by:
        removeProxy in interface ModClusterServiceMBean
        Parameters:
        host - the hostname of the proxy; a string suitable for passing to InetAddress.getByHost(...)
        port - the port on which the proxy listens for MCMP requests
      • stop

        public boolean stop​(long timeout,
                            TimeUnit unit)
        Description copied from interface: ModClusterServiceMBean
        Attempts to gracefully stops all web applications, within the specified timeout.
        1. Disables all contexts
        2. Waits for all sessions to drain
        3. Stops all contexts
        Specified by:
        stop in interface ModClusterServiceMBean
        Parameters:
        timeout - number of units of time for which to wait for sessions to drain. Negative or zero timeout value will wait forever.
        unit - unit of time represented in timeout parameter
        Returns:
        true, if all contexts stopped successfully, false if sessions fail to drain before specified timeout.
      • stopContext

        public boolean stopContext​(String host,
                                   String path,
                                   long timeout,
                                   TimeUnit unit)
        Description copied from interface: ModClusterServiceMBean
        Attempts to gracefully stops a single web application, within the specified timeout.
        1. Disables the specified context
        2. Waits for all sessions for the specified context to drain
        3. Stops the specified context
        Specified by:
        stopContext in interface ModClusterServiceMBean
        timeout - number of units of time for which to wait for sessions to drain. Negative or zero timeout value will wait forever.
        unit - unit of time represented in timeout parameter
        Returns:
        true, if the specified context was stopped successfully, false if sessions fail to drain before specified timeout.
      • getProxyConfigurationString

        public String getProxyConfigurationString()
      • getProxyInfoString

        public String getProxyInfoString()
      • stop

        public boolean stop​(long timeout)
      • stopContext

        public boolean stopContext​(String host,
                                   String path,
                                   long timeout)
      • setConnectorAddress

        public void setConnectorAddress​(String connectorAddress)
      • setConnectorPort

        public void setConnectorPort​(int connectorPort)
      • setExternalConnectorAddress

        public void setExternalConnectorAddress​(String externalConnectorAddress)
      • setExternalConnectorPort

        public void setExternalConnectorPort​(int externalConnectorPort)
      • getAdvertiseGroupAddress

        public String getAdvertiseGroupAddress()
      • setAdvertiseGroupAddress

        public void setAdvertiseGroupAddress​(String advertiseGroupAddress)
      • getAdvertisePort

        public int getAdvertisePort()
      • setAdvertisePort

        public void setAdvertisePort​(int advertisePort)
      • setAdvertiseInterface

        public void setAdvertiseInterface​(String advertiseInterface)
      • setAdvertiseInterfaceName

        public void setAdvertiseInterfaceName​(String advertiseInterfaceName)
      • setProxyList

        public void setProxyList​(String addresses)
      • getProxyList

        public String getProxyList()
      • setExcludedContexts

        public void setExcludedContexts​(String contexts)
      • getExcludedContexts

        public String getExcludedContexts()
      • setSessionDrainingStrategy

        public void setSessionDrainingStrategy​(String sessionDrainingStrategy)