HeartbeatListener (Apache Tomcat 10.1.57 API Documentation)
Description: declaration: package: org.apache.catalina.ha.backend, class: HeartbeatListener

# Class HeartbeatListener

java.lang.Object
org.apache.catalina.ha.backend.HeartbeatListener

All Implemented Interfaces:
  `LifecycleListener`

public class HeartbeatListener extends Object implements LifecycleListener
Lifecycle listener that provides heartbeat information to mod_heartbeat for Apache HTTP Server. Message format: "v=%u&ready=%u&busy=%u"

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected String`
  `host`
  Host of the connector to proxy.
  `protected String`
  `ip`
  Multicast IP address.
  `protected int`
  `multiport`
  Multicast port.
  `protected int`
  `port`
  Port of the connector to proxy.
  `protected String`
  `proxyList`
  Proxy list, format "address:port,address:port".
  `protected String`
  `proxyURL`
  URL prefix.
  `protected int`
  `ttl`
  Time-to-live for multicast packets.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `HeartbeatListener()`
  Constructs a new HeartbeatListener.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `getGroup()`
  Get the multicast IP address used for sending heartbeat messages.
  `String`
  `getHost()`
  Get the host corresponding to the connector we want to proxy.
  `int`
  `getMultiport()`
  Get the multicast port used for sending heartbeat messages.
  `int`
  `getPort()`
  Get the port of the connector we want to proxy.
  `String`
  `getProxyList()`
  Get the list of proxies that send requests to this server.
  `String`
  `getProxyURL()`
  Get the URL specified in <Location/> for the SetHandler heartbeat in httpd.conf.
  `int`
  `getTtl()`
  Get the TTL value used for multicast packets.
  `void`
  `lifecycleEvent(LifecycleEvent event)`
  Acknowledge the occurrence of the specified event.
  `void`
  `setGroup(String group)`
  Set the Multicast IP to use for Multicast
  `void`
  `setHost(String host)`
  Set the host corresponding to the connector.
  `void`
  `setMultiport(int port)`
  Set the Port to use for Multicast
  `void`
  `setPort(int port)`
  Set the port corresponding to the connector.
  `void`
  `setProxyList(String proxyList)`
  Set the list of Proxies that send is requests, when not empty it toggles the multi to off.
  `void`
  `setProxyURLString(String proxyURL)`
  Set the URL of receiver in httpd.
  `void`
  `setTtl(int ttl)`
  Set the TTL for Multicast packets.

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### port

    protected int port
    Port of the connector to proxy. Default is 8009.

  - ### host

    protected String host
    Host of the connector to proxy.

  - ### ip

    protected String ip
    Multicast IP address. Default is 224.0.1.105.

  - ### multiport

    protected int multiport
    Multicast port. Default is 23364.

  - ### ttl

    protected int ttl
    Time-to-live for multicast packets. Default is 16.

  - ### proxyList

    protected String proxyList
    Proxy list, format "address:port,address:port".

  - ### proxyURL

    protected String proxyURL
    URL prefix.

- ## Constructor Details

  - ### HeartbeatListener

    public HeartbeatListener()
    Constructs a new HeartbeatListener.

- ## Method Details

  - ### getHost

    public String getHost()
    Get the host corresponding to the connector we want to proxy.
    Returns:
      the host

  - ### setHost

    public void setHost(String host)
    Set the host corresponding to the connector.
    Parameters:
      `host` - the hostname or ip string.

  - ### getPort

    public int getPort()
    Get the port of the connector we want to proxy.
    Returns:
      the port

  - ### setPort

    public void setPort(int port)
    Set the port corresponding to the connector.
    Parameters:
      `port` - default 8009 the ajp one.

  - ### getGroup

    public String getGroup()
    Get the multicast IP address used for sending heartbeat messages.
    Returns:
      the multicast IP address

  - ### setGroup

    public void setGroup(String group)
    Set the Multicast IP to use for Multicast
    Parameters:
      `group` - the multi address to use.

  - ### getMultiport

    public int getMultiport()
    Get the multicast port used for sending heartbeat messages.
    Returns:
      the multicast port

  - ### setMultiport

    public void setMultiport(int port)
    Set the Port to use for Multicast
    Parameters:
      `port` - the port to use.

  - ### getTtl

    public int getTtl()
    Get the TTL value used for multicast packets.
    Returns:
      the TTL value

  - ### setTtl

    public void setTtl(int ttl)
    Set the TTL for Multicast packets.
    Parameters:
      `ttl` - value for TTL.

  - ### getProxyList

    public String getProxyList()
    Get the list of proxies that send requests to this server.
    Returns:
      the proxy list in "address:port,address:port" format

  - ### setProxyList

    public void setProxyList(String proxyList)
    Set the list of Proxies that send is requests, when not empty it toggles the multi to off. A SetHandler heartbeat must be existing in httpd.conf.
    Parameters:
      `proxyList` - the list of proxy, format "address:port,address:port".

  - ### getProxyURL

    public String getProxyURL()
    Get the URL specified in <Location/> for the SetHandler heartbeat in httpd.conf.
    Returns:
      the proxy URL

  - ### setProxyURLString

    public void setProxyURLString(String proxyURL)
    Set the URL of receiver in httpd. That is the location used in

        <Location "/HeartbeatListener">
           SetHandler heartbeat
        </Location>

    All proxies MUST use the same location.
    Parameters:
      `proxyURL` - a String with the URL starting with /

  - ### lifecycleEvent

    public void lifecycleEvent(LifecycleEvent event)
    Description copied from interface: `LifecycleListener`
    Acknowledge the occurrence of the specified event.
    Specified by:
      `lifecycleEvent` in interface `LifecycleListener`
    Parameters:
      `event` - LifecycleEvent that has occurred