public final class MulticastRMICacheManagerPeerProvider extends RMICacheManagerPeerProvider implements CacheManagerPeerProvider
Hosts can be in three different levels of conformance with the Multicast specification (RFC1112), according to the requirements they meet.
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.
| Modifier and Type | Class and Description |
|---|---|
protected static class |
MulticastRMICacheManagerPeerProvider.CachePeerEntry
Entry containing a looked up CachePeer and date
|
| Modifier and Type | Field and Description |
|---|---|
protected static int |
SHORT_DELAY
One tenth of a second, in ms
|
cacheManager, peerUrls| Constructor and Description |
|---|
MulticastRMICacheManagerPeerProvider(CacheManager cacheManager,
InetAddress groupMulticastAddress,
Integer groupMulticastPort,
Integer timeToLive,
InetAddress hostAddress)
Creates and starts a multicast peer provider
|
| Modifier and Type | Method and Description |
|---|---|
void |
dispose()
Shutdown the heartbeat
|
MulticastKeepaliveHeartbeatReceiver |
getHeartBeatReceiver() |
MulticastKeepaliveHeartbeatSender |
getHeartBeatSender() |
protected long |
getStaleTime()
The time after which an unrefreshed peer provider entry is considered stale.
|
long |
getTimeForClusterToForm()
Time for a cluster to form.
|
void |
init()
Notifies providers to initialise themselves.
|
List |
listRemoteCachePeers(Ehcache cache) |
void |
registerPeer(String rmiUrl)
Register a new peer, but only if the peer is new, otherwise the last seen timestamp is updated.
|
protected boolean |
stale(Date date)
Whether the entry should be considered stale.
|
getCacheManager, getScheme, lookupRemoteCachePeer, unregisterPeerclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetScheme, unregisterPeerprotected static final int SHORT_DELAY
public MulticastRMICacheManagerPeerProvider(CacheManager cacheManager, InetAddress groupMulticastAddress, Integer groupMulticastPort, Integer timeToLive, InetAddress hostAddress)
groupMulticastAddress - 224.0.0.1 to 239.255.255.255 e.g. 230.0.0.1groupMulticastPort - 1025 to 65536 e.g. 4446hostAddress - the address of the interface to use for sending and receiving multicast. May be null.public final void init()
throws CacheException
init in interface CacheManagerPeerProviderinit in class RMICacheManagerPeerProviderCacheExceptionpublic final void registerPeer(String rmiUrl)
This method is thread-safe. It relies on peerUrls being a synchronizedMap
registerPeer in interface CacheManagerPeerProviderregisterPeer in class RMICacheManagerPeerProviderrmiUrl - public final List listRemoteCachePeers(Ehcache cache) throws CacheException
listRemoteCachePeers in interface CacheManagerPeerProviderlistRemoteCachePeers in class RMICacheManagerPeerProviderCachePeer peers, excluding the local peer.CacheExceptionpublic final void dispose()
dispose in interface CacheManagerPeerProviderdispose in class RMICacheManagerPeerProviderpublic long getTimeForClusterToForm()
getTimeForClusterToForm in interface CacheManagerPeerProviderprotected long getStaleTime()
protected final boolean stale(Date date)
stale in class RMICacheManagerPeerProviderdate - the date the entry was createdpublic MulticastKeepaliveHeartbeatReceiver getHeartBeatReceiver()
public MulticastKeepaliveHeartbeatSender getHeartBeatSender()
Copyright 2001-2021, Terracotta, Inc.