org.hibernate.cache.jbc.timestamp
Class TimestampsRegionImpl

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

public class TimestampsRegionImpl
extends TransactionalDataRegionAdapter
implements TimestampsRegion

Defines the behavior of the timestamps cache region for JBossCache 2.x. TODO Need to define a way to ensure asynchronous replication events do not result in timestamps moving backward, while dealing with the fact that the normal sequence of UpdateTimestampsCache.preinvalidate() then UpdateTimestampsCache.invalidate() will result in 2 calls to put() with the latter call having an earlier timestamp.

Version:
$Revision: 17023 $
Author:
Brian Stansberry

Field Summary
static String TYPE
           
 
Fields inherited from class org.hibernate.cache.jbc.TransactionalDataRegionAdapter
metadata
 
Fields inherited from class org.hibernate.cache.jbc.BasicRegionAdapter
currentView, internalFqn, invalidateState, invalidationMutex, ITEM, jbcCache, log, memberId, optimistic, regionFqn, regionName, regionRoot, regionRootMutex, replication, transactionManager
 
Constructor Summary
TimestampsRegionImpl(org.jboss.cache.Cache jbcCache, String regionName, String regionPrefix, Properties properties)
          Create a new TimestampsRegionImpl.
 
Method Summary
protected  org.jboss.cache.Fqn<String> createRegionFqn(String regionName, String regionPrefix)
           
 void destroy()
          The "end state" contract of the region's lifecycle.
 void evict(Object key)
          Evict an item from the cache immediately (without regard for transaction isolation).
 void evictAll()
          Evict all contents of this particular cache region (without regard for transaction isolation).
 Object get(Object key)
          Get an item from the cache.
protected  boolean handleEvictAllInvalidation(org.jboss.cache.notifications.event.NodeInvalidatedEvent event)
           
protected  boolean handleEvictAllModification(org.jboss.cache.notifications.event.NodeModifiedEvent event)
           
 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 put(Object key, Object value)
          Put an item into the cache.
 
Methods inherited from class org.hibernate.cache.jbc.TransactionalDataRegionAdapter
getCacheDataDescription, isTransactionAware
 
Methods inherited from class org.hibernate.cache.jbc.BasicRegionAdapter
activateLocalClusterNode, checkValid, contains, deactivateLocalNode, ensureRegionRootExists, escapeRegionName, getCacheInstance, getElementCountInMemory, getElementCountOnDisk, getMemberId, getName, getNonLockingDataVersionOption, getRegionFqn, getSizeInMemory, getTimeout, getTypeFirstRegionFqn, getTypeLastRegionFqn, 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
contains, getElementCountInMemory, getElementCountOnDisk, getName, getSizeInMemory, getTimeout, nextTimestamp, toMap
 

Field Detail

TYPE

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

TimestampsRegionImpl

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

Parameters:
jbcCache - The JBC cache instance to use to store the timestamps data
regionName - The name of the region (within the JBC cache)
regionPrefix - Any region prefix to apply
properties - The configuration properties.
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
Description copied from interface: GeneralDataRegion
Evict an item from the cache immediately (without regard for transaction isolation).

Specified by:
evict in interface GeneralDataRegion
Parameters:
key - The key of the item to remove
Throws:
CacheException - Indicates a problem accessing the item or region.

evictAll

public void evictAll()
              throws CacheException
Description copied from interface: GeneralDataRegion
Evict all contents of this particular cache region (without regard for transaction isolation).

Specified by:
evictAll in interface GeneralDataRegion
Throws:
CacheException - Indicates problem accessing the region.

get

public Object get(Object key)
           throws CacheException
Description copied from interface: GeneralDataRegion
Get an item from the cache.

Specified by:
get in interface GeneralDataRegion
Parameters:
key - The key of the item to be retrieved.
Returns:
the cached object or null
Throws:
CacheException - Indicates a problem accessing the item or region.

put

public void put(Object key,
                Object value)
         throws CacheException
Description copied from interface: GeneralDataRegion
Put an item into the cache.

Specified by:
put in interface GeneralDataRegion
Parameters:
key - The key under which to cache the item.
value - The item to cache.
Throws:
CacheException - Indicates a problem accessing the region.

destroy

public void destroy()
             throws CacheException
Description copied from interface: Region
The "end state" contract of the region's lifecycle. Called during SessionFactory.close() to give the region a chance to cleanup.

Specified by:
destroy in interface Region
Overrides:
destroy in class BasicRegionAdapter
Throws:
CacheException - Indicates problem shutting down

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 -

handleEvictAllInvalidation

protected boolean handleEvictAllInvalidation(org.jboss.cache.notifications.event.NodeInvalidatedEvent event)
Overrides:
handleEvictAllInvalidation in class BasicRegionAdapter

handleEvictAllModification

protected boolean handleEvictAllModification(org.jboss.cache.notifications.event.NodeModifiedEvent event)
Overrides:
handleEvictAllModification in class BasicRegionAdapter


Copyright © 2001-2010 Red Hat, Inc. All Rights Reserved.