org.apache.jcs.engine
Class ZombieCacheServiceNonLocal<K extends Serializable,V extends Serializable>

java.lang.Object
  extended by org.apache.jcs.engine.ZombieCacheService<K,V>
      extended by org.apache.jcs.engine.ZombieCacheServiceNonLocal<K,V>
All Implemented Interfaces:
Remote, ICacheService<K,V>, ICacheServiceNonLocal<K,V>, IZombie

public class ZombieCacheServiceNonLocal<K extends Serializable,V extends Serializable>
extends ZombieCacheService<K,V>
implements ICacheServiceNonLocal<K,V>

Zombie adapter for the non local cache services. 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 non local cache will walk the queue. The queue must be bounded so it does not eat memory.

This originated in the remote cache.


Nested Class Summary
protected static class ZombieCacheServiceNonLocal.ZombieEvent
          Base of the other events.
 
Constructor Summary
ZombieCacheServiceNonLocal()
          Default.
ZombieCacheServiceNonLocal(int maxQueueSize)
          Sets the maximum number of items that will be allowed on the queue.
 
Method Summary
 ICacheElement<K,V> get(String cacheName, K key, long requesterId)
          Does nothing.
 Set<K> getGroupKeys(String cacheName, String groupName)
          Does nothing.
 Set<String> getGroupNames(String cacheName)
          Does nothing.
 Map<K,ICacheElement<K,V>> getMatching(String cacheName, String pattern, long requesterId)
          Does nothing.
 Map<K,ICacheElement<K,V>> getMultiple(String cacheName, Set<K> 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.
 void propagateEvents(ICacheServiceNonLocal<K,V> service)
          Walk the queue, calling the service for each queue operation.
 void remove(String cacheName, K key, long listenerId)
          Adds a removeAll event to the queue if the maxSize is greater than 0;
 void removeAll(String cacheName, long listenerId)
          Adds a removeAll event to the queue if the maxSize is greater than 0;
 void update(ICacheElement<K,V> 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

ZombieCacheServiceNonLocal

public ZombieCacheServiceNonLocal()
Default.


ZombieCacheServiceNonLocal

public ZombieCacheServiceNonLocal(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<K,V> item,
                   long listenerId)
Adds an update event to the queue if the maxSize is greater than 0;

Specified by:
update in interface ICacheServiceNonLocal<K extends Serializable,V extends Serializable>
Parameters:
item - ICacheElement
listenerId - - identifies the caller.

remove

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

Specified by:
remove in interface ICacheServiceNonLocal<K extends Serializable,V extends Serializable>
Parameters:
cacheName - - region name
key - - item key
listenerId - - identifies the caller.

removeAll

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

Specified by:
removeAll in interface ICacheServiceNonLocal<K extends Serializable,V extends Serializable>
Parameters:
cacheName - - name of the region
listenerId - - identifies the caller.

get

public ICacheElement<K,V> get(String cacheName,
                              K key,
                              long requesterId)
                                                                 throws IOException
Does nothing. Gets are synchronous and cannot be added to a queue.

Specified by:
get in interface ICacheServiceNonLocal<K extends Serializable,V extends Serializable>
Parameters:
cacheName - - region name
key - - item key
requesterId - - identifies the caller.
Returns:
null
Throws:
IOException

getMatching

public Map<K,ICacheElement<K,V>> getMatching(String cacheName,
                                             String pattern,
                                             long requesterId)
                                                                                                     throws IOException
Does nothing.

Specified by:
getMatching in interface ICacheServiceNonLocal<K extends Serializable,V extends Serializable>
Parameters:
cacheName -
pattern -
requesterId -
Returns:
empty map
Throws:
IOException

getMultiple

public Map<K,ICacheElement<K,V>> getMultiple(String cacheName,
                                             Set<K> keys,
                                             long requesterId)
Description copied from interface: ICacheServiceNonLocal
Gets multiple items from the cache based on the given set of keys.

Specified by:
getMultiple in interface ICacheServiceNonLocal<K extends Serializable,V extends Serializable>
Parameters:
cacheName - - region name
keys - - item key
requesterId - - identity of the caller
Returns:
an empty map. zombies have no internal data

getGroupKeys

public Set<K> getGroupKeys(String cacheName,
                           String groupName)
Does nothing.

Specified by:
getGroupKeys in interface ICacheServiceNonLocal<K extends Serializable,V extends Serializable>
Parameters:
cacheName - - region name
groupName - - group name
Returns:
empty set

getGroupNames

public Set<String> getGroupNames(String cacheName)
Does nothing.

Specified by:
getGroupNames in interface ICacheServiceNonLocal<K extends Serializable,V extends Serializable>
Parameters:
cacheName - - region name
Returns:
empty set

propagateEvents

public void propagateEvents(ICacheServiceNonLocal<K,V> service)
                     throws Exception
Walk the queue, calling the service for each queue operation.

Parameters:
service -
Throws:
Exception


Copyright © 2002-2013 The Apache Software Foundation. All Rights Reserved.