com.bankframe.services.cache
Class JMSCacheImpl

java.lang.Object
  extended by com.bankframe.services.cache.GenericCache
      extended by com.bankframe.services.cache.JMSCacheImpl
All Implemented Interfaces:
Cache, JMSCache, NamedCache, PersistentCache, Map

public class JMSCacheImpl
extends GenericCache
implements JMSCache

The JMSCacheImpl class provides generic caching functionality using a distributed cache within a clustered environment. It implements the java.util.Map interface. This class uses the supplied Map implementation to maintain consistency between the cache and the data store. The supplied Map implementation must store and read its contents from some permanent data store. An object will remain in the cache until it expires. When the object expires is determined by the CachePolicy object. Once an object has been removed from the local cache a message is generted and put on a JMS Topic. This message will be read by other instances in the cluster via the Message Driven Bean (MDB) com.bankframe.services.cache.JMSListener. This MDB will remove the entry supplied in the message from the local cache on that cluster node.

Version:
6.1.2

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Field Summary
 String JMS_FACTORY
           
static String JMS_MESSAGE_ID_CACHE
           
static String JNDI_FACTORY
           
 String TOPIC
           
 
Constructor Summary
JMSCacheImpl()
           
 
Method Summary
 Object addValueToCache(String topicName, Object key, Object value)
           
 void initialiseTopic(Context ctx, JMSCacheEvent event)
          Creates all the necessary objects for sending messages to a JMS Topic.
 Object put(Object key, Object value)
          This method updates the specified object to the data-store.
 void putAll(Map t)
          This method places the specified values in the cache and the data-store.
 Object remove(Object key)
          This method removes the specified object from the cache and the data store.
 void remove(Set keySet)
          This method removes the specified keys from the cache and the data store.
 void removeAll()
          Removes all objects from the cache and from the data store.
 void removeAllDontSend()
           
 Object removeDontSend(Object key)
           
 void removeDontSend(Set keySet)
           
 
Methods inherited from class com.bankframe.services.cache.GenericCache
addCacheListener, cleanup, clear, containsKey, containsValue, enableCaching, entrySet, equals, get, getCachePolicy, getFromPersistentMap, getName, getPersistentMap, hashCode, isEmpty, keySet, removeCacheListener, setCachePolicy, setName, setPersistentMap, size, toString, values
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.bankframe.services.cache.Cache
addCacheListener, cleanup, enableCaching, getCachePolicy, removeCacheListener, setCachePolicy
 
Methods inherited from interface java.util.Map
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, size, values
 

Field Detail

JNDI_FACTORY

public static String JNDI_FACTORY

JMS_FACTORY

public String JMS_FACTORY

TOPIC

public String TOPIC

JMS_MESSAGE_ID_CACHE

public static final String JMS_MESSAGE_ID_CACHE
See Also:
Constant Field Values
Constructor Detail

JMSCacheImpl

public JMSCacheImpl()
Method Detail

initialiseTopic

public void initialiseTopic(Context ctx,
                            JMSCacheEvent event)
                     throws NamingException,
                            JMSException
Creates all the necessary objects for sending messages to a JMS Topic.

Parameters:
ctx - JNDI initial context
event -
Throws:
NamingException - if problem occurred with the JNDI context interface
JMSException - if JMS fails to initialize due to internal error

put

public Object put(Object key,
                  Object value)
Description copied from class: GenericCache
This method updates the specified object to the data-store. It also updates the reference stored in the cache. If the object does not exist in the data-store it will be created.

Specified by:
put in interface Map
Overrides:
put in class GenericCache
Parameters:
key - Unique key identifying the object
value - The object
See Also:
Map.put(Object, Object)

putAll

public void putAll(Map t)
Description copied from class: GenericCache
This method places the specified values in the cache and the data-store. :param values a map of values to add to the cache.

Specified by:
putAll in interface Map
Overrides:
putAll in class GenericCache
See Also:
Map.putAll(Map)

removeDontSend

public Object removeDontSend(Object key)
Specified by:
removeDontSend in interface JMSCache
See Also:
Map.remove(Object)

removeDontSend

public void removeDontSend(Set keySet)
Specified by:
removeDontSend in interface JMSCache
See Also:
Cache.remove(Set)

removeAllDontSend

public void removeAllDontSend()
Specified by:
removeAllDontSend in interface JMSCache
See Also:
Cache.removeAll()

remove

public Object remove(Object key)
Description copied from class: GenericCache
This method removes the specified object from the cache and the data store.

Specified by:
remove in interface Map
Overrides:
remove in class GenericCache
Parameters:
key - Unique key identifying the object to remove
See Also:
Map.remove(Object)

remove

public void remove(Set keySet)
Description copied from class: GenericCache
This method removes the specified keys from the cache and the data store.

Specified by:
remove in interface Cache
Overrides:
remove in class GenericCache
Parameters:
keySet - the set of keys to remove
See Also:
Cache.remove(Set)

removeAll

public void removeAll()
Description copied from class: GenericCache
Removes all objects from the cache and from the data store. Use this method with caution!

Specified by:
removeAll in interface Cache
Overrides:
removeAll in class GenericCache
See Also:
Cache.removeAll()

addValueToCache

public Object addValueToCache(String topicName,
                              Object key,
                              Object value)


Copyright © 2005, 2007, Oracle. All rights reserved.