ehcache

net.sf.ehcache.distribution
Class RMICacheManagerPeerProvider

java.lang.Object
  extended by net.sf.ehcache.distribution.RMICacheManagerPeerProvider
All Implemented Interfaces:
CacheManagerPeerProvider
Direct Known Subclasses:
ManualRMICacheManagerPeerProvider, MulticastRMICacheManagerPeerProvider

public abstract class RMICacheManagerPeerProvider
extends Object
implements CacheManagerPeerProvider

A provider of Peer RMI addresses.

Version:
$Id: RMICacheManagerPeerProvider.java 5594 2012-05-07 16:04:31Z cdennis $
Author:
Greg Luck

Field Summary
protected  CacheManager cacheManager
          The CacheManager this peer provider is associated with.
protected  Map peerUrls
          Contains a RMI URLs of the form: "//" + hostName + ":" + port + "/" + cacheName;
 
Constructor Summary
RMICacheManagerPeerProvider()
          Empty constructor
RMICacheManagerPeerProvider(CacheManager cacheManager)
          Constructor
 
Method Summary
 void dispose()
          Providers may be doing all sorts of exotic things and need to be able to clean up on dispose.
 CacheManager getCacheManager()
          The cacheManager this provider is bound to
 String getScheme()
          The replication scheme.
abstract  void init()
          Notifies providers to initialise themselves.
abstract  List listRemoteCachePeers(Ehcache cache)
           
 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.
abstract  void registerPeer(String rmiUrl)
          Register a new peer
protected abstract  boolean stale(Date date)
          Whether the entry should be considered stale.
 void unregisterPeer(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 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:
init in interface CacheManagerPeerProvider

registerPeer

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

Specified by:
registerPeer in interface CacheManagerPeerProvider
Parameters:
rmiUrl -

unregisterPeer

public final void unregisterPeer(String rmiUrl)
Unregisters a peer

Specified by:
unregisterPeer in interface CacheManagerPeerProvider
Parameters:
rmiUrl -

listRemoteCachePeers

public abstract List listRemoteCachePeers(Ehcache cache)
                                   throws CacheException
Specified by:
listRemoteCachePeers in interface CacheManagerPeerProvider
Returns:
a list of CachePeer peers for the given cache, excluding the local peer.
Throws:
CacheException

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

lookupRemoteCachePeer

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.

Throws:
MalformedURLException
NotBoundException
RemoteException

dispose

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

Specified by:
dispose in interface CacheManagerPeerProvider
Throws:
CacheException

getCacheManager

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


getScheme

public 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. Each CacheReplicator should lookup the provider for its scheme type during replication. Similarly a BootstrapCacheLoader should also look up the provider for its scheme.

Specified by:
getScheme in interface CacheManagerPeerProvider
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

ehcache

Copyright 2001-2016, Terracotta, Inc.