org.hibernate.cache
Class OptimisticTreeCacheProvider

java.lang.Object
  extended by org.hibernate.cache.OptimisticTreeCacheProvider
All Implemented Interfaces:
CacheProvider

public class OptimisticTreeCacheProvider
extends Object
implements CacheProvider

Support for a standalone JBossCache TreeCache instance utilizing TreeCache's optimistic locking capabilities. This capability was added in JBossCache version 1.3.0; as such this provider will only work with that version or higher.

The TreeCache instance is configured via a local config resource. The resource to be used for configuration can be controlled by specifying a value for the CONFIG_RESOURCE config property.

Author:
Steve Ebersole

Field Summary
static String CONFIG_RESOURCE
          Deprecated. use Environment.CACHE_PROVIDER_CONFIG
static String DEFAULT_CONFIG
           
 
Constructor Summary
OptimisticTreeCacheProvider()
           
 
Method Summary
 Cache buildCache(String regionName, Properties properties)
          Construct and configure the Cache representation of a named cache region.
 org.jboss.cache.TreeCache getUnderlyingCache()
           
 boolean isMinimalPutsEnabledByDefault()
           
 long nextTimestamp()
          Generate a timestamp
 void start(Properties properties)
          Prepare the underlying JBossCache TreeCache instance.
 void stop()
          Callback to perform any necessary cleanup of the underlying cache implementation during SessionFactory.close().
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONFIG_RESOURCE

public static final String CONFIG_RESOURCE
Deprecated. use Environment.CACHE_PROVIDER_CONFIG
See Also:
Constant Field Values

DEFAULT_CONFIG

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

OptimisticTreeCacheProvider

public OptimisticTreeCacheProvider()
Method Detail

buildCache

public Cache buildCache(String regionName,
                        Properties properties)
                 throws CacheException
Construct and configure the Cache representation of a named cache region.

Specified by:
buildCache in interface CacheProvider
Parameters:
regionName - the name of the cache region
properties - configuration settings
Returns:
The Cache representation of the named cache region.
Throws:
CacheException - Indicates an error building the cache region.

nextTimestamp

public long nextTimestamp()
Description copied from interface: CacheProvider
Generate a timestamp

Specified by:
nextTimestamp in interface CacheProvider

start

public void start(Properties properties)
Prepare the underlying JBossCache TreeCache instance.

Specified by:
start in interface CacheProvider
Parameters:
properties - All current config settings.
Throws:
CacheException - Indicates a problem preparing cache for use.

stop

public void stop()
Description copied from interface: CacheProvider
Callback to perform any necessary cleanup of the underlying cache implementation during SessionFactory.close().

Specified by:
stop in interface CacheProvider

isMinimalPutsEnabledByDefault

public boolean isMinimalPutsEnabledByDefault()
Specified by:
isMinimalPutsEnabledByDefault in interface CacheProvider

getUnderlyingCache

public org.jboss.cache.TreeCache getUnderlyingCache()