com.bankframe.services.cache
Class JMSCache

java.lang.Object
  extended bycom.bankframe.services.cache.GenericCache
      extended bycom.bankframe.services.cache.JMSCache
All Implemented Interfaces:
Cache, java.util.Map, NamedCache, PersistentCache

public class JMSCache
extends GenericCache

The JMSCache 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.

Author:
jlogan

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

Field Detail

NODE

public static java.lang.String NODE

JNDI_FACTORY

public static java.lang.String JNDI_FACTORY

JMS_FACTORY

public java.lang.String JMS_FACTORY

TOPIC

public java.lang.String TOPIC

JMS_MESSAGE_ID_CACHE

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

JMSCache

public JMSCache()
Method Detail

initialiseTopic

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

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

put

public java.lang.Object put(java.lang.Object key,
                            java.lang.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 java.util.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(java.util.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 java.util.Map
Overrides:
putAll in class GenericCache
See Also:
Map.putAll(Map)

removeDontSend

public java.lang.Object removeDontSend(java.lang.Object key)
See Also:
Map.remove(Object)

removeDontSend

public void removeDontSend(java.util.Set keySet)
See Also:
Cache.remove(Set)

removeAllDontSend

public void removeAllDontSend()
See Also:
Cache.removeAll()

remove

public java.lang.Object remove(java.lang.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 java.util.Map
Overrides:
remove in class GenericCache
Parameters:
key - Unique key identifying the object to remove
See Also:
Map.remove(Object)

remove

public void remove(java.util.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 java.lang.Object addValueToCache(java.lang.String topicName,
                                        java.lang.Object key,
                                        java.lang.Object value)


Copyright © 2004 Siebel Systems, Inc. All rights reserved.