net.sf.ehcache.distribution
Class MulticastRMICacheManagerPeerProvider
public final
class
MulticastRMICacheManagerPeerProvider
extends RMICacheManagerPeerProvider
implements CacheManagerPeerProvider
A peer provider which discovers peers using Multicast.
Hosts can be in three different levels of conformance with the Multicast specification (RFC1112), according to the requirements they meet.
- Level 0 is the "no support for IP Multicasting" level. Lots of hosts and routers in the Internet are in this state,
as multicast support is not mandatory in IPv4 (it is, however, in IPv6).
Not too much explanation is needed here: hosts in this level can neither send nor receive multicast packets.
They must ignore the ones sent by other multicast capable hosts.
- Level 1 is the "support for sending but not receiving multicast IP datagrams" level.
Thus, note that it is not necessary to join a multicast group to be able to send datagrams to it.
Very few additions are needed in the IP module to make a "Level 0" host "Level 1-compliant".
- Level 2 is the "full support for IP multicasting" level.
Level 2 hosts must be able to both send and receive multicast traffic.
They must know the way to join and leave multicast groups and to propagate this information to multicast routers.
Thus, they must include an Internet Group Management Protocol (IGMP) implementation in their TCP/IP stack.
The list of CachePeers is maintained via heartbeats. rmiUrls are looked up using RMI and converted to CachePeers on
registration. On lookup any stale references are removed.
Version: $Id: MulticastRMICacheManagerPeerProvider.java 52 2006-04-24 14:50:03Z gregluck $
Author: Greg Luck
public static final int STALE_PEER_TIME_MS
The number of ms until the peer is considered to be offline. Once offline it will not be sent
notifications.
public MulticastRMICacheManagerPeerProvider(
CacheManager cacheManager, InetAddress groupMulticastAddress, Integer groupMulticastPort)
Creates and starts a multicast peer provider
Parameters: groupMulticastAddress 224.0.0.1 to 239.255.255.255 e.g. 230.0.0.1 groupMulticastPort 1025 to 65536 e.g. 4446
public final void dispose()
Shutdown the heartbeat
public final void init()
{@inheritDoc }
public final List listRemoteCachePeers(
Cache cache)
Returns: a list of CachePeer peers, excluding the local peer.
public final void registerPeer(String rmiUrl)
Register a new peer.
Parameters: rmiUrl
protected final boolean stale(Date date)
Whether the entry should be considered stale.
This will depend on the type of RMICacheManagerPeerProvider.
This method should be overridden for implementations that go stale based on date
Parameters: date the date the entry was created
Returns: true if stale