net.sf.ehcache.distribution

Class RMICacheManagerPeerListener

public final class RMICacheManagerPeerListener extends Object implements CacheManagerPeerListener

A cache server which exposes available cache operations remotely through RMI.

It acts as a Decorator to a Cache. It holds an instance of cache, which is a local cache it talks to.

This class could specify a security manager with code like:

 if (System.getSecurityManager() == null) {
     System.setSecurityManager(new RMISecurityManager());
 }
 
Doing so would require the addition of grant statements in the java.policy file.

Per the JDK documentation: "If no security manager is specified no class loading, by RMI clients or servers, is allowed, aside from what can be found in the local CLASSPATH." The classpath of each instance of this class should have all required classes to enable distribution, so no remote classloading is required or desirable. Accordingly, no security manager is set and there are no special JVM configuration requirements.

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

Author: Greg Luck

Constructor Summary
RMICacheManagerPeerListener(String hostName, Integer port, CacheManager cacheManager, Integer socketTimeoutMillis)
Constructor with full arguments.
Method Summary
voiddispose()
Stop the listener.
ListgetBoundCachePeers()
All of the caches which are listenting for remote changes.
ListgetCachePeers()
Gets a list of cache peers
voidinit()
String[]listBoundRMICachePeers()
Returns a list of bound objects.
RemotelookupPeer(String name)
Returns a reference to the remote object.

Constructor Detail

RMICacheManagerPeerListener

public RMICacheManagerPeerListener(String hostName, Integer port, CacheManager cacheManager, Integer socketTimeoutMillis)
Constructor with full arguments.

Parameters: hostName may be null, in which case the hostName will be looked up. Machines with multiple interfaces should specify this if they do not want it to be the default NIC. port a port in the range 1025 - 65536 cacheManager the CacheManager this listener belongs to socketTimeoutMillis TCP/IP Socket timeout when waiting on response

Method Detail

dispose

public final void dispose()
Stop the listener. It

getBoundCachePeers

public final List getBoundCachePeers()
All of the caches which are listenting for remote changes.

Returns: a list of RMICachePeer objects

getCachePeers

final List getCachePeers()
Gets a list of cache peers

init

public final void init()
{@inheritDoc }

listBoundRMICachePeers

final String[] listBoundRMICachePeers()
Returns a list of bound objects.

This should match the list of cachePeers i.e. they should always be bound

Returns: a list of String representations of RMICachePeer objects

lookupPeer

final Remote lookupPeer(String name)
Returns a reference to the remote object.

Parameters: name the name of the cache e.g. sampleCache1