org.hibernate.cache.jbc2.timestamp
Class ClusteredConcurrentTimestampsRegionImpl

java.lang.Object
  extended by org.hibernate.cache.jbc2.BasicRegionAdapter
      extended by org.hibernate.cache.jbc2.TransactionalDataRegionAdapter
          extended by org.hibernate.cache.jbc2.timestamp.ClusteredConcurrentTimestampsRegionImpl
All Implemented Interfaces:
GeneralDataRegion, Region, TimestampsRegion, TransactionalDataRegion

public class ClusteredConcurrentTimestampsRegionImpl
extends TransactionalDataRegionAdapter
implements TimestampsRegion

Prototype of a clustered timestamps cache region impl usable if the TimestampsRegion API is changed.

Maintains a local (authoritative) cache of timestamps along with the distributed cache held in JBoss Cache. Listens for changes in the distributed cache and updates the local cache accordingly. Ensures that any changes in the local cache represent either 1) an increase in the timestamp or 2) a stepback in the timestamp by the caller that initially increased it as part of a pre-invalidate call. This approach allows timestamp changes to be replicated asynchronously by JBoss Cache while still preventing invalid backward changes in timestamps.

NOTE: This is just a prototype!!! Only useful if we change the TimestampsRegion API.

Version:
$Revision: 14106 $
Author:
Brian Stansberry

Field Summary
static String TYPE
           
 
Fields inherited from class org.hibernate.cache.jbc2.TransactionalDataRegionAdapter
metadata
 
Fields inherited from class org.hibernate.cache.jbc2.BasicRegionAdapter
currentView, internalFqn, invalidateState, invalidationMutex, ITEM, jbcCache, log, memberId, optimistic, regionFqn, regionName, regionRoot, regionRootMutex, replication, transactionManager
 
Constructor Summary
ClusteredConcurrentTimestampsRegionImpl(org.jboss.cache.Cache jbcCache, String regionName, String regionPrefix, Properties properties)
          Create a new ClusteredConccurentTimestampsRegionImpl.
 
Method Summary
protected  org.jboss.cache.Fqn<String> createRegionFqn(String regionName, String regionPrefix)
           
 void destroy()
           
 void evict(Object key)
           
 void evictAll()
           
 Object get(Object key)
           
 void invalidate(Object key, Object value, Object preInvalidateValue)
           
 void nodeModified(org.jboss.cache.notifications.event.NodeModifiedEvent event)
          Monitors cache events and updates the local cache
 void nodeRemoved(org.jboss.cache.notifications.event.NodeRemovedEvent event)
          Monitors cache events and updates the local cache
 void preInvalidate(Object key, Object value)
           
 void put(Object key, Object value)
           
 
Methods inherited from class org.hibernate.cache.jbc2.TransactionalDataRegionAdapter
getCacheDataDescription, isTransactionAware
 
Methods inherited from class org.hibernate.cache.jbc2.BasicRegionAdapter
activateLocalClusterNode, checkValid, contains, deactivateLocalNode, ensureRegionRootExists, escapeRegionName, getCacheInstance, getElementCountInMemory, getElementCountOnDisk, getMemberId, getName, getNonLockingDataVersionOption, getRegionFqn, getSizeInMemory, getTimeout, getTypeFirstRegionFqn, getTypeLastRegionFqn, handleEvictAllInvalidation, handleEvictAllModification, nextTimestamp, nodeInvalidated, resume, suspend, suspendAndGet, toMap, viewChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.hibernate.cache.Region
getElementCountInMemory, getElementCountOnDisk, getName, getSizeInMemory, getTimeout, nextTimestamp, toMap
 

Field Detail

TYPE

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

ClusteredConcurrentTimestampsRegionImpl

public ClusteredConcurrentTimestampsRegionImpl(org.jboss.cache.Cache jbcCache,
                                               String regionName,
                                               String regionPrefix,
                                               Properties properties)
Create a new ClusteredConccurentTimestampsRegionImpl.

Parameters:
jbcCache -
regionName -
regionPrefix - TODO
metadata -
Method Detail

createRegionFqn

protected org.jboss.cache.Fqn<String> createRegionFqn(String regionName,
                                                      String regionPrefix)
Specified by:
createRegionFqn in class BasicRegionAdapter

evict

public void evict(Object key)
           throws CacheException
Specified by:
evict in interface GeneralDataRegion
Throws:
CacheException

evictAll

public void evictAll()
              throws CacheException
Specified by:
evictAll in interface GeneralDataRegion
Throws:
CacheException

get

public Object get(Object key)
           throws CacheException
Specified by:
get in interface GeneralDataRegion
Throws:
CacheException

put

public void put(Object key,
                Object value)
         throws CacheException
Specified by:
put in interface GeneralDataRegion
Throws:
CacheException

preInvalidate

public void preInvalidate(Object key,
                          Object value)
                   throws CacheException
Throws:
CacheException

invalidate

public void invalidate(Object key,
                       Object value,
                       Object preInvalidateValue)
                throws CacheException
Throws:
CacheException

destroy

public void destroy()
             throws CacheException
Specified by:
destroy in interface Region
Overrides:
destroy in class BasicRegionAdapter
Throws:
CacheException

nodeModified

public void nodeModified(org.jboss.cache.notifications.event.NodeModifiedEvent event)
Monitors cache events and updates the local cache

Overrides:
nodeModified in class BasicRegionAdapter
Parameters:
event -

nodeRemoved

public void nodeRemoved(org.jboss.cache.notifications.event.NodeRemovedEvent event)
Monitors cache events and updates the local cache

Parameters:
event -


Copyright © 2011 Hibernate.org. All Rights Reserved.