Package org.apache.catalina.ha.backend
Class HeartbeatListener
- java.lang.Object
-
- org.apache.catalina.ha.backend.HeartbeatListener
-
- All Implemented Interfaces:
LifecycleListener
public class HeartbeatListener extends java.lang.Object implements LifecycleListener
Lifecycle listener that provides heartbeat information to mod_heartbeat for Apache HTTP Server.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.StringhostHost of the connector to proxy.protected java.lang.StringipMulticast IP address.protected intmultiportMulticast port.protected intportPort of the connector to proxy.protected java.lang.StringproxyListProxy list, format "address:port,address:port".protected java.lang.StringproxyURLURL prefix.protected intttlTime-to-live for multicast packets.
-
Constructor Summary
Constructors Constructor Description HeartbeatListener()Constructs a new HeartbeatListener.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetGroup()Get the multicast IP address used for sending heartbeat messages.java.lang.StringgetHost()Get the host corresponding to the connector we want to proxy.intgetMultiport()Get the multicast port used for sending heartbeat messages.intgetPort()Get the port of the connector we want to proxy.java.lang.StringgetProxyList()Get the list of proxies that send requests to this server.java.lang.StringgetProxyURL()Get the URL specified in <Location/> for the SetHandler heartbeat in httpd.conf.intgetTtl()Get the TTL value used for multicast packets.voidlifecycleEvent(LifecycleEvent event)Acknowledge the occurrence of the specified event.voidsetGroup(java.lang.String group)Set the Multicast IP to use for MulticastvoidsetHost(java.lang.String host)Set the host corresponding to the connector.voidsetMultiport(int port)Set the Port to use for MulticastvoidsetPort(int port)Set the port corresponding to the connector.voidsetProxyList(java.lang.String proxyList)Set the list of Proxies that send is requests, when not empty it toggles the multi to off.voidsetProxyURLString(java.lang.String proxyURL)Set the URL of receiver in httpd.voidsetTtl(int ttl)Set the TTL for Multicast packets.
-
-
-
Field Detail
-
port
protected int port
Port of the connector to proxy. Default is 8009.
-
host
protected java.lang.String host
Host of the connector to proxy.
-
ip
protected java.lang.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 java.lang.String proxyList
Proxy list, format "address:port,address:port".
-
proxyURL
protected java.lang.String proxyURL
URL prefix.
-
-
Method Detail
-
getHost
public java.lang.String getHost()
Get the host corresponding to the connector we want to proxy.- Returns:
- the host
-
setHost
public void setHost(java.lang.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 java.lang.String getGroup()
Get the multicast IP address used for sending heartbeat messages.- Returns:
- the multicast IP address
-
setGroup
public void setGroup(java.lang.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 java.lang.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(java.lang.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 java.lang.String getProxyURL()
Get the URL specified in <Location/> for the SetHandler heartbeat in httpd.conf.- Returns:
- the proxy URL
-
setProxyURLString
public void setProxyURLString(java.lang.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:LifecycleListenerAcknowledge the occurrence of the specified event.- Specified by:
lifecycleEventin interfaceLifecycleListener- Parameters:
event- LifecycleEvent that has occurred
-
-