org.hibernate.cache.jbc2.entity
Class OptimisticReadOnlyAccess

java.lang.Object
  extended by org.hibernate.cache.jbc2.entity.TransactionalAccess
      extended by org.hibernate.cache.jbc2.entity.OptimisticTransactionalAccess
          extended by org.hibernate.cache.jbc2.entity.OptimisticReadOnlyAccess
All Implemented Interfaces:
EntityRegionAccessStrategy

public class OptimisticReadOnlyAccess
extends OptimisticTransactionalAccess

This defines the strategy for read-only access to enity data in an optimistic-locking JBossCache using its 2.x APIs

The read-only access to a JBossCache really is still transactional, just with the extra semantic or guarantee that we will not update data.

Author:
Brian Stansberry

Field Summary
 
Fields inherited from class org.hibernate.cache.jbc2.entity.TransactionalAccess
region
 
Constructor Summary
OptimisticReadOnlyAccess(EntityRegionImpl region)
           
 
Method Summary
 boolean afterUpdate(Object key, Object value, Object currentVersion, Object previousVersion, SoftLock lock)
           
 SoftLock lockItem(Object key, Object version)
           
 SoftLock lockRegion()
           
 void unlockItem(Object key, SoftLock lock)
           
 void unlockRegion(SoftLock lock)
           
 boolean update(Object key, Object value, Object currentVersion, Object previousVersion)
           
 
Methods inherited from class org.hibernate.cache.jbc2.entity.TransactionalAccess
afterInsert, evict, evictAll, get, getRegion, insert, putFromLoad, putFromLoad, remove, removeAll
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OptimisticReadOnlyAccess

public OptimisticReadOnlyAccess(EntityRegionImpl region)
Method Detail

lockItem

public SoftLock lockItem(Object key,
                         Object version)
                  throws CacheException
Specified by:
lockItem in interface EntityRegionAccessStrategy
Overrides:
lockItem in class TransactionalAccess
Throws:
CacheException

lockRegion

public SoftLock lockRegion()
                    throws CacheException
Specified by:
lockRegion in interface EntityRegionAccessStrategy
Overrides:
lockRegion in class TransactionalAccess
Throws:
CacheException

unlockItem

public void unlockItem(Object key,
                       SoftLock lock)
                throws CacheException
Specified by:
unlockItem in interface EntityRegionAccessStrategy
Overrides:
unlockItem in class TransactionalAccess
Throws:
CacheException

unlockRegion

public void unlockRegion(SoftLock lock)
                  throws CacheException
Specified by:
unlockRegion in interface EntityRegionAccessStrategy
Overrides:
unlockRegion in class TransactionalAccess
Throws:
CacheException

update

public boolean update(Object key,
                      Object value,
                      Object currentVersion,
                      Object previousVersion)
               throws CacheException
Specified by:
update in interface EntityRegionAccessStrategy
Overrides:
update in class TransactionalAccess
Throws:
CacheException

afterUpdate

public boolean afterUpdate(Object key,
                           Object value,
                           Object currentVersion,
                           Object previousVersion,
                           SoftLock lock)
                    throws CacheException
Specified by:
afterUpdate in interface EntityRegionAccessStrategy
Overrides:
afterUpdate in class TransactionalAccess
Throws:
CacheException


Copyright © 2011 Hibernate.org. All Rights Reserved.