org.hibernate.cache.jbc.access
Class TransactionalAccessDelegate

java.lang.Object
  extended by org.hibernate.cache.jbc.access.TransactionalAccessDelegate
Direct Known Subclasses:
OptimisticTransactionalAccessDelegate

public class TransactionalAccessDelegate
extends Object

Defines the strategy for transactional access to entity or collection data in a pessimistic-locking JBoss Cache using its 2.x APIs.

The intent of this class is to encapsulate common code and serve as a delegate for EntityRegionAccessStrategy and CollectionRegionAccessStrategy implementations.

Author:
Brian Stansberry

Field Summary
protected  org.jboss.cache.Cache cache
           
protected  boolean invalidation
           
protected  PutFromLoadValidator putValidator
           
protected  BasicRegionAdapter region
           
protected  org.jboss.cache.Fqn regionFqn
           
 
Constructor Summary
TransactionalAccessDelegate(BasicRegionAdapter adapter, PutFromLoadValidator validator)
           
 
Method Summary
 boolean afterInsert(Object key, Object value, Object version)
           
 boolean afterUpdate(Object key, Object value, Object currentVersion, Object previousVersion, SoftLock lock)
           
 void evict(Object key)
           
 void evictAll()
           
 Object get(Object key, long txTimestamp)
           
 boolean insert(Object key, Object value, Object version)
           
 SoftLock lockItem(Object key, Object version)
           
 SoftLock lockRegion()
           
 boolean putFromLoad(Object key, Object value, long txTimestamp, Object version)
           
 boolean putFromLoad(Object key, Object value, long txTimestamp, Object version, boolean minimalPutOverride)
           
 void remove(Object key)
           
 void removeAll()
           
 void unlockItem(Object key, SoftLock lock)
           
 void unlockRegion(SoftLock lock)
           
 boolean update(Object key, Object value, Object currentVersion, Object previousVersion)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cache

protected final org.jboss.cache.Cache cache

regionFqn

protected final org.jboss.cache.Fqn regionFqn

invalidation

protected final boolean invalidation

region

protected final BasicRegionAdapter region

putValidator

protected final PutFromLoadValidator putValidator
Constructor Detail

TransactionalAccessDelegate

public TransactionalAccessDelegate(BasicRegionAdapter adapter,
                                   PutFromLoadValidator validator)
Method Detail

get

public Object get(Object key,
                  long txTimestamp)
           throws CacheException
Throws:
CacheException

putFromLoad

public boolean putFromLoad(Object key,
                           Object value,
                           long txTimestamp,
                           Object version)
                    throws CacheException
Throws:
CacheException

putFromLoad

public boolean putFromLoad(Object key,
                           Object value,
                           long txTimestamp,
                           Object version,
                           boolean minimalPutOverride)
                    throws CacheException
Throws:
CacheException

lockItem

public SoftLock lockItem(Object key,
                         Object version)
                  throws CacheException
Throws:
CacheException

lockRegion

public SoftLock lockRegion()
                    throws CacheException
Throws:
CacheException

unlockItem

public void unlockItem(Object key,
                       SoftLock lock)
                throws CacheException
Throws:
CacheException

unlockRegion

public void unlockRegion(SoftLock lock)
                  throws CacheException
Throws:
CacheException

insert

public boolean insert(Object key,
                      Object value,
                      Object version)
               throws CacheException
Throws:
CacheException

afterInsert

public boolean afterInsert(Object key,
                           Object value,
                           Object version)
                    throws CacheException
Throws:
CacheException

update

public boolean update(Object key,
                      Object value,
                      Object currentVersion,
                      Object previousVersion)
               throws CacheException
Throws:
CacheException

afterUpdate

public boolean afterUpdate(Object key,
                           Object value,
                           Object currentVersion,
                           Object previousVersion,
                           SoftLock lock)
                    throws CacheException
Throws:
CacheException

remove

public void remove(Object key)
            throws CacheException
Throws:
CacheException

removeAll

public void removeAll()
               throws CacheException
Throws:
CacheException

evict

public void evict(Object key)
           throws CacheException
Throws:
CacheException

evictAll

public void evictAll()
              throws CacheException
Throws:
CacheException


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