org.hibernate.cache
Class OptimisticTreeCache

java.lang.Object
  extended by org.hibernate.cache.OptimisticTreeCache
All Implemented Interfaces:
Cache, OptimisticCache, TransactionAwareCache

public class OptimisticTreeCache
extends Object
implements OptimisticCache, TransactionAwareCache

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

Author:
Steve Ebersole
See Also:
for more details

Nested Class Summary
static class OptimisticTreeCache.CircumventChecksDataVersion
          Used to signal to a DataVersionAdapter to simply not perform any checks.
static class OptimisticTreeCache.DataVersionAdapter
           
static class OptimisticTreeCache.NonLockingDataVersion
          Used in regions where no locking should ever occur.
 
Constructor Summary
OptimisticTreeCache(org.jboss.cache.TreeCache cache, String regionName)
           
 
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(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

OptimisticTreeCache

public OptimisticTreeCache(org.jboss.cache.TreeCache cache,
                           String regionName)
                    throws CacheException
Throws:
CacheException
Method Detail

setSource

public void setSource(OptimisticCacheSource source)
Specified by:
setSource in interface OptimisticCache

writeInsert

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

writeUpdate

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

writeLoad

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

get

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

read

public Object read(Object key)
            throws CacheException
Specified by:
read in interface Cache
Throws:
CacheException

update

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

put

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

remove

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

clear

public void clear()
           throws CacheException
Specified by:
clear in interface Cache
Throws:
CacheException

destroy

public void destroy()
             throws CacheException
Specified by:
destroy in interface Cache
Throws:
CacheException

lock

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

unlock

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

nextTimestamp

public long nextTimestamp()
Specified by:
nextTimestamp in interface Cache

getTimeout

public int getTimeout()
Specified by:
getTimeout in interface Cache

getRegionName

public String getRegionName()
Specified by:
getRegionName in interface Cache

getSizeInMemory

public long getSizeInMemory()
Specified by:
getSizeInMemory in interface Cache

getElementCountInMemory

public long getElementCountInMemory()
Specified by:
getElementCountInMemory in interface Cache

getElementCountOnDisk

public long getElementCountOnDisk()
Specified by:
getElementCountOnDisk in interface Cache

toMap

public Map toMap()
Specified by:
toMap in interface Cache

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2009 Hibernate.org. All Rights Reserved.