net.sf.ehcache.distribution

Class RMICacheManagerPeerProvider

public abstract class RMICacheManagerPeerProvider extends Object implements CacheManagerPeerProvider

A provider of Peer RMI addresses.

Version: $Id: RMICacheManagerPeerProvider.java 52 2006-04-24 14:50:03Z gregluck $

Author: Greg Luck

Field Summary
protected MappeerUrls
Contains a RMI URLs of the form: "//" + hostName + ":" + port + "/" + cacheName;
Constructor Summary
RMICacheManagerPeerProvider(CacheManager cacheManager)
Constructor
RMICacheManagerPeerProvider()
Empty constructor
Method Summary
voiddispose()
Providers may be doing all sorts of exotic things and need to be able to clean up on dispose.
static StringextractCacheName(String rmiUrl)
Gets the cache name out of the url
CacheManagergetCacheManager()
The cacheManager this provider is bound to
abstract voidinit()
abstract ListlistRemoteCachePeers(Cache cache)
static CachePeerlookupRemoteCachePeer(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(String rmiUrl)
Register a new peer
protected abstract booleanstale(Date date)
Whether the entry should be considered stale.
voidunregisterPeer(String rmiUrl)
Unregisters a peer

Field Detail

peerUrls

protected final Map peerUrls
Contains a RMI URLs of the form: "//" + hostName + ":" + port + "/" + cacheName;

Constructor Detail

RMICacheManagerPeerProvider

public RMICacheManagerPeerProvider(CacheManager cacheManager)
Constructor

Parameters: cacheManager

RMICacheManagerPeerProvider

public RMICacheManagerPeerProvider()
Empty constructor

Method Detail

dispose

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

Throws: net.sf.ehcache.CacheException

extractCacheName

static String extractCacheName(String rmiUrl)
Gets the cache name out of the url

Parameters: rmiUrl

Returns: the cache name as it would appear in ehcache.xml

getCacheManager

public final CacheManager getCacheManager()
The cacheManager this provider is bound to

init

public abstract void init()
{@inheritDoc }

listRemoteCachePeers

public abstract List listRemoteCachePeers(Cache cache)

Returns: a list of CachePeer peers for the given cache, excluding the local peer.

lookupRemoteCachePeer

public static 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. They will simply replace the ones that were there.

registerPeer

public abstract void registerPeer(String rmiUrl)
Register a new peer

Parameters: rmiUrl

stale

protected abstract boolean stale(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

unregisterPeer

public final void unregisterPeer(String rmiUrl)
Unregisters a peer

Parameters: rmiUrl