org.apache.jcs.auxiliary.remote
Class ZombieRemoteCacheService

java.lang.Object
  extended by org.apache.jcs.engine.ZombieCacheService
      extended by org.apache.jcs.auxiliary.remote.ZombieRemoteCacheService
All Implemented Interfaces:
java.rmi.Remote, IRemoteCacheService, ICacheService, IZombie

public class ZombieRemoteCacheService
extends ZombieCacheService
implements IRemoteCacheService

Zombie adapter for the remote cache service. It just balks if there is no queue configured.

If a queue is configured, then events will be added to the queue. The idea is that when proper operation is restored, the remote cache will walk the queue. The queue must be bounded so it does not eat memory.

Much of this is potentially reusable.

TODO figure out a way to get the propagate method into an interface for Zombies.


Constructor Summary
ZombieRemoteCacheService()
          Default.
ZombieRemoteCacheService(int maxQueueSize)
          Sets the maximum number of items that will be allowed on the queue.
 
Method Summary
 ICacheElement get(java.lang.String cacheName, java.io.Serializable key, long requesterId)
          Does nothing.
 java.util.Set getGroupKeys(java.lang.String cacheName, java.lang.String groupName)
          Does nothing.
 java.util.Map getMatching(java.lang.String cacheName, java.lang.String pattern, long requesterId)
          Gets multiple items from the cache matching the pattern.
 java.util.Map getMultiple(java.lang.String cacheName, java.util.Set keys, long requesterId)
          Gets multiple items from the cache based on the given set of keys.
 int getQueueSize()
          Gets the number of items on the queue.
protected  void propagateEvents(IRemoteCacheService service)
          Walk the queue, calling the service for each queue operation.
 void remove(java.lang.String cacheName, java.io.Serializable key, long listenerId)
          Adds a removeAll event to the queue if the maxSize is greater than 0;
 void removeAll(java.lang.String cacheName, long listenerId)
          Adds a removeAll event to the queue if the maxSize is greater than 0;
 void update(ICacheElement item, long listenerId)
          Adds an update event to the queue if the maxSize is greater than 0;
 
Methods inherited from class org.apache.jcs.engine.ZombieCacheService
dispose, get, get, getMatching, getMultiple, put, release, remove, removeAll, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.jcs.engine.behavior.ICacheService
dispose, get, getMatching, getMultiple, release, remove, removeAll, update
 

Constructor Detail

ZombieRemoteCacheService

public ZombieRemoteCacheService()
Default.


ZombieRemoteCacheService

public ZombieRemoteCacheService(int maxQueueSize)
Sets the maximum number of items that will be allowed on the queue.

Parameters:
maxQueueSize -
Method Detail

getQueueSize

public int getQueueSize()
Gets the number of items on the queue.

Returns:
size of the queue.

update

public void update(ICacheElement item,
                   long listenerId)
Adds an update event to the queue if the maxSize is greater than 0;

(non-Javadoc)

Specified by:
update in interface IRemoteCacheService
See Also:
IRemoteCacheService.update(org.apache.jcs.engine.behavior.ICacheElement, long)

remove

public void remove(java.lang.String cacheName,
                   java.io.Serializable key,
                   long listenerId)
Adds a removeAll event to the queue if the maxSize is greater than 0;

(non-Javadoc)

Specified by:
remove in interface IRemoteCacheService
See Also:
IRemoteCacheService.remove(java.lang.String, java.io.Serializable, long)

removeAll

public void removeAll(java.lang.String cacheName,
                      long listenerId)
Adds a removeAll event to the queue if the maxSize is greater than 0;

(non-Javadoc)

Specified by:
removeAll in interface IRemoteCacheService
See Also:
IRemoteCacheService.removeAll(java.lang.String, long)

get

public ICacheElement get(java.lang.String cacheName,
                         java.io.Serializable key,
                         long requesterId)
                  throws java.io.IOException
Does nothing. Gets are synchronous and cannot be added to a queue.

(non-Javadoc)

Specified by:
get in interface IRemoteCacheService
Returns:
ICacheElement
Throws:
java.io.IOException
See Also:
IRemoteCacheService.get(java.lang.String, java.io.Serializable, long)

getMatching

public java.util.Map getMatching(java.lang.String cacheName,
                                 java.lang.String pattern,
                                 long requesterId)
                          throws java.io.IOException
Description copied from interface: IRemoteCacheService
Gets multiple items from the cache matching the pattern.

Specified by:
getMatching in interface IRemoteCacheService
Parameters:
cacheName -
pattern -
requesterId -
Returns:
empty map
Throws:
java.io.IOException

getMultiple

public java.util.Map getMultiple(java.lang.String cacheName,
                                 java.util.Set keys,
                                 long requesterId)
Description copied from interface: IRemoteCacheService
Gets multiple items from the cache based on the given set of keys.

Specified by:
getMultiple in interface IRemoteCacheService
Parameters:
cacheName -
keys -
requesterId -
Returns:
an empty map. zombies have no internal data

getGroupKeys

public java.util.Set getGroupKeys(java.lang.String cacheName,
                                  java.lang.String groupName)
Does nothing.

(non-Javadoc)

Specified by:
getGroupKeys in interface IRemoteCacheService
Returns:
A Set of keys
See Also:
IRemoteCacheService.getGroupKeys(java.lang.String, java.lang.String)

propagateEvents

protected void propagateEvents(IRemoteCacheService service)
                        throws java.lang.Exception
Walk the queue, calling the service for each queue operation.

Parameters:
service -
Throws:
java.lang.Exception


Copyright © 2002-2010 Apache Software Foundation. All Rights Reserved.