Package net.sf.ehcache.distribution
Class RMICacheManagerPeerProvider
- java.lang.Object
-
- net.sf.ehcache.distribution.RMICacheManagerPeerProvider
-
- All Implemented Interfaces:
CacheManagerPeerProvider
- Direct Known Subclasses:
ManualRMICacheManagerPeerProvider,MulticastRMICacheManagerPeerProvider
public abstract class RMICacheManagerPeerProvider extends java.lang.Object implements CacheManagerPeerProvider
A provider of Peer RMI addresses.- Version:
- $Id$
- Author:
- Greg Luck
-
-
Field Summary
Fields Modifier and Type Field Description protected CacheManagercacheManagerThe CacheManager this peer provider is associated with.protected java.util.MappeerUrlsContains a RMI URLs of the form: "//" + hostName + ":" + port + "/" + cacheName;
-
Constructor Summary
Constructors Constructor Description RMICacheManagerPeerProvider()Empty constructorRMICacheManagerPeerProvider(CacheManager cacheManager)Constructor
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voiddispose()Providers may be doing all sorts of exotic things and need to be able to clean up on dispose.CacheManagergetCacheManager()The cacheManager this provider is bound tojava.lang.StringgetScheme()The replication scheme.abstract voidinit()Notifies providers to initialise themselves.abstract java.util.ListlistRemoteCachePeers(Ehcache cache)CachePeerlookupRemoteCachePeer(java.lang.String url)The use of one-time registry creation and Naming.rebind should mean we can create as many listeneres as we like.abstract voidregisterPeer(java.lang.String rmiUrl)Register a new peerprotected abstract booleanstale(java.util.Date date)Whether the entry should be considered stale.voidunregisterPeer(java.lang.String rmiUrl)Unregisters a peer-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.sf.ehcache.distribution.CacheManagerPeerProvider
getTimeForClusterToForm
-
-
-
-
Field Detail
-
peerUrls
protected final java.util.Map peerUrls
Contains a RMI URLs of the form: "//" + hostName + ":" + port + "/" + cacheName;
-
cacheManager
protected CacheManager cacheManager
The CacheManager this peer provider is associated with.
-
-
Constructor Detail
-
RMICacheManagerPeerProvider
public RMICacheManagerPeerProvider(CacheManager cacheManager)
Constructor- Parameters:
cacheManager-
-
RMICacheManagerPeerProvider
public RMICacheManagerPeerProvider()
Empty constructor
-
-
Method Detail
-
init
public abstract void init()
Notifies providers to initialise themselves.- Specified by:
initin interfaceCacheManagerPeerProvider
-
registerPeer
public abstract void registerPeer(java.lang.String rmiUrl)
Register a new peer- Specified by:
registerPeerin interfaceCacheManagerPeerProvider- Parameters:
rmiUrl-
-
unregisterPeer
public final void unregisterPeer(java.lang.String rmiUrl)
Unregisters a peer- Specified by:
unregisterPeerin interfaceCacheManagerPeerProvider- Parameters:
rmiUrl-
-
listRemoteCachePeers
public abstract java.util.List listRemoteCachePeers(Ehcache cache) throws CacheException
- Specified by:
listRemoteCachePeersin interfaceCacheManagerPeerProvider- Returns:
- a list of
CachePeerpeers for the given cache, excluding the local peer. - Throws:
CacheException
-
stale
protected abstract boolean stale(java.util.Date date)
Whether the entry should be considered stale. This will depend on the type of RMICacheManagerPeerProvider.- Parameters:
date- the date the entry was created- Returns:
- true if stale
-
lookupRemoteCachePeer
public CachePeer lookupRemoteCachePeer(java.lang.String url) throws java.net.MalformedURLException, java.rmi.NotBoundException, java.rmi.RemoteException
The use of one-time registry creation and Naming.rebind should mean we can create as many listeneres as we like. They will simply replace the ones that were there.- Throws:
java.net.MalformedURLExceptionjava.rmi.NotBoundExceptionjava.rmi.RemoteException
-
dispose
public void dispose() throws CacheExceptionProviders may be doing all sorts of exotic things and need to be able to clean up on dispose.- Specified by:
disposein interfaceCacheManagerPeerProvider- Throws:
CacheException
-
getCacheManager
public final CacheManager getCacheManager()
The cacheManager this provider is bound to
-
getScheme
public java.lang.String getScheme()
The replication scheme. Each peer provider has a scheme name, which can be used to specify the scheme for replication and bootstrap purposes. EachCacheReplicatorshould lookup the provider for its scheme type during replication. Similarly aBootstrapCacheLoadershould also look up the provider for its scheme.- Specified by:
getSchemein interfaceCacheManagerPeerProvider- Returns:
- the well-known scheme name, which is determined by the replication provider author.
- Since:
- 1.6 introduced to permit multiple distribution schemes to be used in the same CacheManager
-
-