org.jboss.hibernate.jbc.cacheprovider
Class OptimisticJBCCache

java.lang.Object
  extended by org.jboss.hibernate.jbc.cacheprovider.OptimisticJBCCache
All Implemented Interfaces:
org.hibernate.cache.Cache, org.hibernate.cache.OptimisticCache

public class OptimisticJBCCache
extends Object
implements org.hibernate.cache.OptimisticCache

Represents a particular region within the given JBossCache TreeCache utilizing TreeCache's optimistic locking capabilities.

Author:
Steve Ebersole, Brian Stansberry
See Also:
for more details

Nested Class Summary
static class OptimisticJBCCache.CircumventChecksDataVersion
          Used to signal to a DataVersionAdapter to simply not perform any checks.
static class OptimisticJBCCache.DataVersionAdapter
           
static class OptimisticJBCCache.NonLockingDataVersion
          Used in regions where no locking should ever occur.
 
Constructor Summary
OptimisticJBCCache(org.jboss.cache.TreeCache cache, String regionName, CacheProperties cacheProperties)
           
 
Method Summary
 void clear()
           
 void destroy()
           
 Object get(Object key)
           
 long getElementCountInMemory()
           
 long getElementCountOnDisk()
           
 String getRegionName()
           
 long getSizeInMemory()
           
 int getTimeout()
           
 void lock(Object key)
           
 long nextTimestamp()
           
 void put(Object key, Object value)
           
 Object read(Object key)
           
 void remove(Object key)
           
 void setSource(org.hibernate.cache.OptimisticCacheSource source)
           
 Map toMap()
           
 String toString()
           
 void unlock(Object key)
           
 void update(Object key, Object value)
           
 void writeInsert(Object key, Object value, Object currentVersion)
           
 void writeLoad(Object key, Object value, Object currentVersion)
           
 void writeUpdate(Object key, Object value, Object currentVersion, Object previousVersion)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

OptimisticJBCCache

public OptimisticJBCCache(org.jboss.cache.TreeCache cache,
                          String regionName,
                          CacheProperties cacheProperties)
                   throws org.hibernate.cache.CacheException
Throws:
org.hibernate.cache.CacheException
Method Detail

setSource

public void setSource(org.hibernate.cache.OptimisticCacheSource source)
Specified by:
setSource in interface org.hibernate.cache.OptimisticCache

writeInsert

public void writeInsert(Object key,
                        Object value,
                        Object currentVersion)
Specified by:
writeInsert in interface org.hibernate.cache.OptimisticCache

writeUpdate

public void writeUpdate(Object key,
                        Object value,
                        Object currentVersion,
                        Object previousVersion)
Specified by:
writeUpdate in interface org.hibernate.cache.OptimisticCache

writeLoad

public void writeLoad(Object key,
                      Object value,
                      Object currentVersion)
Specified by:
writeLoad in interface org.hibernate.cache.OptimisticCache

get

public Object get(Object key)
           throws org.hibernate.cache.CacheException
Specified by:
get in interface org.hibernate.cache.Cache
Throws:
org.hibernate.cache.CacheException

read

public Object read(Object key)
            throws org.hibernate.cache.CacheException
Specified by:
read in interface org.hibernate.cache.Cache
Throws:
org.hibernate.cache.CacheException

update

public void update(Object key,
                   Object value)
            throws org.hibernate.cache.CacheException
Specified by:
update in interface org.hibernate.cache.Cache
Throws:
org.hibernate.cache.CacheException

put

public void put(Object key,
                Object value)
         throws org.hibernate.cache.CacheException
Specified by:
put in interface org.hibernate.cache.Cache
Throws:
org.hibernate.cache.CacheException

remove

public void remove(Object key)
            throws org.hibernate.cache.CacheException
Specified by:
remove in interface org.hibernate.cache.Cache
Throws:
org.hibernate.cache.CacheException

clear

public void clear()
           throws org.hibernate.cache.CacheException
Specified by:
clear in interface org.hibernate.cache.Cache
Throws:
org.hibernate.cache.CacheException

destroy

public void destroy()
             throws org.hibernate.cache.CacheException
Specified by:
destroy in interface org.hibernate.cache.Cache
Throws:
org.hibernate.cache.CacheException

lock

public void lock(Object key)
          throws org.hibernate.cache.CacheException
Specified by:
lock in interface org.hibernate.cache.Cache
Throws:
org.hibernate.cache.CacheException

unlock

public void unlock(Object key)
            throws org.hibernate.cache.CacheException
Specified by:
unlock in interface org.hibernate.cache.Cache
Throws:
org.hibernate.cache.CacheException

nextTimestamp

public long nextTimestamp()
Specified by:
nextTimestamp in interface org.hibernate.cache.Cache

getTimeout

public int getTimeout()
Specified by:
getTimeout in interface org.hibernate.cache.Cache

getRegionName

public String getRegionName()
Specified by:
getRegionName in interface org.hibernate.cache.Cache

getSizeInMemory

public long getSizeInMemory()
Specified by:
getSizeInMemory in interface org.hibernate.cache.Cache

getElementCountInMemory

public long getElementCountInMemory()
Specified by:
getElementCountInMemory in interface org.hibernate.cache.Cache

getElementCountOnDisk

public long getElementCountOnDisk()
Specified by:
getElementCountOnDisk in interface org.hibernate.cache.Cache

toMap

public Map toMap()
Specified by:
toMap in interface org.hibernate.cache.Cache

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2008 JBoss, a division of Red Hat, Inc.. All Rights Reserved.