stomp.jdo.kodo
Class UpdatingJMSCache

java.lang.Object
  |
  +--com.solarmetric.kodo.runtime.datacache.plugins.LocalCache
        |
        +--com.solarmetric.kodo.runtime.datacache.plugins.DistributedCache
              |
              +--com.solarmetric.kodo.runtime.datacache.plugins.JMSCache
                    |
                    +--stomp.jdo.kodo.UpdatingJMSCache
All Implemented Interfaces:
com.solarmetric.kodo.conf.Configurable, com.solarmetric.kodo.runtime.datacache.DataCache

public class UpdatingJMSCache
extends com.solarmetric.kodo.runtime.datacache.plugins.JMSCache

JMS-based distributed cache implementation, which transitions Stomp read-only objects to hollow when it becomes aware that their database information has changed. The next read of this object will result in a trip to the database to fetch the new information (unless the transaction occurred in this JVM, in which case the information may be read from a LocalCache).

To use this cache, set com.solarmetric.kodo.DataCacheClass to stomp.jdo.kodo.UpdatingJMSCache,

	com.solarmetric.kodo.DataCacheClass=samples.updatingCache.UpdatingJMSCache
	

Author:
Eric Lindauer

Field Summary
 
Fields inherited from class com.solarmetric.kodo.runtime.datacache.plugins.LocalCache
cache
 
Constructor Summary
UpdatingJMSCache()
           
 
Method Summary
 void batchUpdate(java.util.Map additions, java.util.Map updates, java.util.Collection deletes, java.lang.Object origin)
          Callback made when a transaction in this JVM changes the database information for a persistent object.
protected  void receivedBatchUpdate(java.util.Collection additions, java.util.Collection updates, java.util.Collection deletes)
          Callback made when a transaction in some other JVM changes the database information for a persistent object.
 void setSchemaGroup(java.lang.String group)
          Must be called whenever a JMSCache is constructed.
 
Methods inherited from class com.solarmetric.kodo.runtime.datacache.plugins.JMSCache
broadcastUpdate, close, createMessage, endConfiguration, getMessageListener, setTopic, setTopicConnectionFactory, startConfiguration
 
Methods inherited from class com.solarmetric.kodo.runtime.datacache.plugins.DistributedCache
log, log
 
Methods inherited from class com.solarmetric.kodo.runtime.datacache.plugins.LocalCache
clear, get, getCacheMap, getCacheSize, newCacheMap, pin, put, remove, removeAll, setCacheSize, unpin
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UpdatingJMSCache

public UpdatingJMSCache()
Method Detail

setSchemaGroup

public void setSchemaGroup(java.lang.String group)
Must be called whenever a JMSCache is constructed. This would be the constructor except that we have to integrate with Kodo.


batchUpdate

public void batchUpdate(java.util.Map additions,
                        java.util.Map updates,
                        java.util.Collection deletes,
                        java.lang.Object origin)
Callback made when a transaction in this JVM changes the database information for a persistent object. This method evicts the read-only instances for all changed and deleted ids, so the database changes are immediately visible in the read-only version of objects.

Specified by:
batchUpdate in interface com.solarmetric.kodo.runtime.datacache.DataCache
Overrides:
batchUpdate in class com.solarmetric.kodo.runtime.datacache.plugins.DistributedCache

receivedBatchUpdate

protected void receivedBatchUpdate(java.util.Collection additions,
                                   java.util.Collection updates,
                                   java.util.Collection deletes)
Callback made when a transaction in some other JVM changes the database information for a persistent object. This method evicts the read-only instances for all changed and deleted ids, so the database changes are immediately visible in the read-only version of objects.

Overrides:
receivedBatchUpdate in class com.solarmetric.kodo.runtime.datacache.plugins.DistributedCache