net.sf.ehcache.distribution

Class RMICachePeer

public class RMICachePeer extends UnicastRemoteObject implements CachePeer, Remote

An RMI based implementation of CachePeer.

This class features a customised RMIClientSocketFactory which enables socket timeouts to be configured.

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

Author: Greg Luck

UNKNOWN: FieldCanBeLocal

Constructor Summary
RMICachePeer(Cache cache, String hostName, Integer port, Integer socketTimeoutMillis)
Construct a new remote peer.
Method Summary
CachegetBoundCacheInstance()
Gets the cache instance that this listener is bound to
StringgetGuid()
StringgetName()
Gets the cache name
StringgetUrl()
{@inheritDoc }

This implementation gives an URL which has meaning to the RMI remoting system.

StringgetUrlBase()
{@inheritDoc }

This implementation gives an URL which has meaning to the RMI remoting system.

voidput(Element element)
Puts an Element into the underlying cache without notifying listeners or updating statistics.
booleanremove(Serializable key)
Removes an Element from the underlying cache without notifying listeners or updating statistics.
voidremoveAll()
Removes all cached items.
voidsend(List eventMessages)
Send the cache peer with an ordered list of EventMessages

This enables multiple messages to be delivered in one network invocation.

Constructor Detail

RMICachePeer

public RMICachePeer(Cache cache, String hostName, Integer port, Integer socketTimeoutMillis)
Construct a new remote peer.

Parameters: cache hostName port socketTimeoutMillis

Throws: RemoteException

Method Detail

getBoundCacheInstance

final Cache getBoundCacheInstance()
Gets the cache instance that this listener is bound to

getGuid

public final String getGuid()
{@inheritDoc }

getName

public final String getName()
Gets the cache name

getUrl

public final String getUrl()
{@inheritDoc }

This implementation gives an URL which has meaning to the RMI remoting system.

Returns: the URL, without the scheme, as a string e.g. //hostname:port/cacheName

getUrlBase

public final String getUrlBase()
{@inheritDoc }

This implementation gives an URL which has meaning to the RMI remoting system.

Returns: the URL, without the scheme, as a string e.g. //hostname:port

put

public void put(Element element)
Puts an Element into the underlying cache without notifying listeners or updating statistics.

Parameters: element

Throws: java.rmi.RemoteException IllegalArgumentException IllegalStateException

remove

public final boolean remove(Serializable key)
Removes an Element from the underlying cache without notifying listeners or updating statistics.

Parameters: key

Returns: true if the element was removed, false if it was not found in the cache

Throws: RemoteException IllegalStateException

removeAll

public final void removeAll()
Removes all cached items.

Throws: IllegalStateException if the cache is not STATUS_ALIVE

send

public final void send(List eventMessages)
Send the cache peer with an ordered list of EventMessages

This enables multiple messages to be delivered in one network invocation.