Top Description Fields Constructors Methods
net.sf.ehcache.distribution

public abstract Class RMICacheManagerPeerProvider

extends Object
implements CacheManagerPeerProvider
Class Inheritance
All Implemented Interfaces
net.sf.ehcache.distribution.CacheManagerPeerProvider
Known Direct Subclasses
net.sf.ehcache.distribution.ManualRMICacheManagerPeerProvider, net.sf.ehcache.distribution.MulticastRMICacheManagerPeerProvider
Imports
net.sf.ehcache.CacheException, .CacheManager, .Ehcache, java.net.MalformedURLException, java.rmi.Naming, .NotBoundException, .RemoteException, java.util.Collections, .Date, .HashMap, .List, .Map, org.slf4j.Logger, .LoggerFactory

A provider of Peer RMI addresses.
Author
Greg Luck
Version
$Id: RMICacheManagerPeerProvider.java 10789 2018-04-26 02:08:13Z adahanne $

Field Summary

Modifier and TypeField and Description
protected CacheManager
cacheManager

The CacheManager this peer provider is associated with.

private static final Logger
protected final Map<K, V>
peerUrls

Contains a RMI URLs of the form: "//" + hostName + ":" + port + "/" + cacheName;

Constructor Summary

AccessConstructor and Description
public
RMICacheManagerPeerProvider(CacheManager cacheManager)

Constructor

public
RMICacheManagerPeerProvider()

Empty constructor

Method Summary

Modifier and TypeMethod and Description
public void
dispose()

Implements net.sf.ehcache.distribution.CacheManagerPeerProvider.dispose.

Providers may be doing all sorts of exotic things and need to be able to clean up on dispose.
pack-priv static String

Returns:

the cache name as it would appear in ehcache.xml
extractCacheName
(String rmiUrl)

Gets the cache name out of the url

public final CacheManager
getCacheManager()

The cacheManager this provider is bound to

public String

Returns:

the well-known scheme name, which is determined by the replication provider author.
getScheme
()

Implements net.sf.ehcache.distribution.CacheManagerPeerProvider.getScheme.

The replication scheme.
public abstract void
init()

Redeclares net.sf.ehcache.distribution.CacheManagerPeerProvider.init.

Notifies providers to initialise themselves.
public abstract List<E>

Returns:

a list of net.sf.ehcache.distribution.CachePeer peers for the given cache, excluding the local peer.
listRemoteCachePeers
(Ehcache cache)

Redeclares net.sf.ehcache.distribution.CacheManagerPeerProvider.listRemoteCachePeers.

public CachePeer
lookupRemoteCachePeer(String url)

The use of one-time registry creation and Naming.rebind should mean we can create as many listeneres as we like.

public abstract void
protected abstract boolean

Returns:

true if stale
stale
(Date
the date the entry was created
date
)

Whether the entry should be considered stale.

public final synchronized void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

cacheManagerback to summary
protected CacheManager cacheManager

The CacheManager this peer provider is associated with.

LOGback to summary
private static final Logger LOG
peerUrlsback to summary
protected final Map<K, V> peerUrls

Contains a RMI URLs of the form: "//" + hostName + ":" + port + "/" + cacheName;

Constructor Detail

RMICacheManagerPeerProviderback to summary
public RMICacheManagerPeerProvider(CacheManager cacheManager)

Constructor

RMICacheManagerPeerProviderback to summary
public RMICacheManagerPeerProvider()

Empty constructor

Method Detail

disposeback to summary
public void dispose() throws CacheException

Implements net.sf.ehcache.distribution.CacheManagerPeerProvider.dispose.

Providers may be doing all sorts of exotic things and need to be able to clean up on dispose.

extractCacheNameback to summary
pack-priv static String extractCacheName(String rmiUrl)

Gets the cache name out of the url

Returns:String

the cache name as it would appear in ehcache.xml

getCacheManagerback to summary
public final CacheManager getCacheManager()

The cacheManager this provider is bound to

getSchemeback to summary
public String getScheme()

Implements net.sf.ehcache.distribution.CacheManagerPeerProvider.getScheme.

The replication scheme. Each peer provider has a scheme name, which can be used to specify the scheme for replication and bootstrap purposes. Each CacheReplicator should lookup the provider for its scheme type during replication. Similarly a BootstrapCacheLoader should also look up the provider for its scheme.

Returns:String

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
initback to summary
public abstract void init()

Redeclares net.sf.ehcache.distribution.CacheManagerPeerProvider.init.

Doc from net.sf.ehcache.distribution.CacheManagerPeerProvider.init.

Notifies providers to initialise themselves.

listRemoteCachePeersback to summary
public abstract List<E> listRemoteCachePeers(Ehcache cache) throws CacheException

Redeclares net.sf.ehcache.distribution.CacheManagerPeerProvider.listRemoteCachePeers.

Returns:List<E>

a list of net.sf.ehcache.distribution.CachePeer peers for the given cache, excluding the local peer.

lookupRemoteCachePeerback to summary
public CachePeer lookupRemoteCachePeer(String url) throws MalformedURLException, NotBoundException, 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.

registerPeerback to summary
public abstract void registerPeer(String rmiUrl)

Redeclares net.sf.ehcache.distribution.CacheManagerPeerProvider.registerPeer.

Register a new peer

staleback to summary
protected abstract boolean stale(Date date)

Whether the entry should be considered stale. This will depend on the type of RMICacheManagerPeerProvider.

Parameters
date:Date

the date the entry was created

Returns:boolean

true if stale

unregisterPeerback to summary
public final synchronized void unregisterPeer(String rmiUrl)

Implements net.sf.ehcache.distribution.CacheManagerPeerProvider.unregisterPeer.

Unregisters a peer