public final class MulticastKeepaliveHeartbeatSender extends Object
You can control how far the multicast packets propagate by setting the badly misnamed "TTL". Using the multicast IP protocol, the TTL value indicates the scope or range in which a packet may be forwarded. By convention:
Constructor and Description |
---|
MulticastKeepaliveHeartbeatSender(CacheManager cacheManager,
InetAddress multicastAddress,
Integer multicastPort,
Integer timeToLive,
InetAddress hostAddress)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
dispose()
Shutdown this heartbeat sender
|
static long |
getHeartBeatInterval()
Returns the heartbeat interval.
|
static long |
getHeartBeatStaleTime()
Returns the time after which a heartbeat is considered stale.
|
Integer |
getTimeToLive() |
void |
init()
Start the heartbeat thread
|
static void |
setHeartBeatInterval(long heartBeatInterval)
Sets the heartbeat interval to something other than the default of 5000ms.
|
static void |
setHeartBeatStaleTime(long heartBeatStaleTime)
Sets the heartbeat stale time to something other than the default of
((2 * HeartBeatInterval) + 100)ms . |
public MulticastKeepaliveHeartbeatSender(CacheManager cacheManager, InetAddress multicastAddress, Integer multicastPort, Integer timeToLive, InetAddress hostAddress)
cacheManager
- the bound CacheManager. Each CacheManager has a maximum of one sendermulticastAddress
- multicastPort
- timeToLive
- See class description for the meaning of this parameter.public final void init()
public final void dispose()
public static void setHeartBeatInterval(long heartBeatInterval)
heartBeatInterval
- a time in ms, greater than 1000public static void setHeartBeatStaleTime(long heartBeatStaleTime)
((2 * HeartBeatInterval) + 100)ms
.
This is useful for testing, but not recommended for production. This method is static and so affects the stale
time all users.heartBeatStaleTime
- a time in mspublic static long getHeartBeatInterval()
public static long getHeartBeatStaleTime()
public Integer getTimeToLive()
Copyright 2001-2020, Terracotta, Inc.