org.jboss.hibernate.jbc.cacheprovider
Class JmxBoundTreeCacheProvider

java.lang.Object
  extended by org.hibernate.cache.TreeCacheProvider
      extended by org.jboss.hibernate.jbc.cacheprovider.JmxBoundTreeCacheProvider
All Implemented Interfaces:
org.hibernate.cache.CacheProvider
Direct Known Subclasses:
OptimisticJmxBoundTreeCacheProvider

public class JmxBoundTreeCacheProvider
extends org.hibernate.cache.TreeCacheProvider
implements org.hibernate.cache.CacheProvider

Support for integration as a 2nd level cache with an already existing JBoss Cache (TreeCache) instance. The ObjectName of the cache is provided via the hibernate.treecache.mbean.object_name configuration property.

This class supports both optimistic and pessimistic locking, providing instances of org.hibernate.cache.OptimisticCache if the underlying JBoss Cache is configured for optimistic locking.

Author:
Gavin King, Brian Stansberry, Galder Zamarreno

Field Summary
 
Fields inherited from class org.hibernate.cache.TreeCacheProvider
CONFIG_RESOURCE, DEFAULT_CONFIG
 
Constructor Summary
JmxBoundTreeCacheProvider()
           
 
Method Summary
 org.hibernate.cache.Cache buildCache(String regionName, Properties properties)
          Construct and configure the Cache representation of a named cache region.
protected  TransactionManager getTransactionManager(Properties properties)
           
 org.jboss.cache.TreeCache getUnderlyingCache()
           
 boolean isMinimalPutsEnabledByDefault()
           
 boolean isOptimistic()
           
 long nextTimestamp()
           
 void start(Properties properties)
          Find the underlying JBoss Cache TreeCache instance.
 void stop()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JmxBoundTreeCacheProvider

public JmxBoundTreeCacheProvider()
Method Detail

buildCache

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

Specified by:
buildCache in interface org.hibernate.cache.CacheProvider
Overrides:
buildCache in class org.hibernate.cache.TreeCacheProvider
Parameters:
regionName - the name of the cache region
properties - configuration settings
Returns:
The Cache representation of the named cache region. If the underlying JBoss Cache is configured for optimistic locking, the returned object will also implement org.hibernate.cache.OptimisticCache.
Throws:
org.hibernate.cache.CacheException - Indicates an error building the cache region.

isMinimalPutsEnabledByDefault

public boolean isMinimalPutsEnabledByDefault()
Specified by:
isMinimalPutsEnabledByDefault in interface org.hibernate.cache.CacheProvider
Overrides:
isMinimalPutsEnabledByDefault in class org.hibernate.cache.TreeCacheProvider

nextTimestamp

public long nextTimestamp()
Specified by:
nextTimestamp in interface org.hibernate.cache.CacheProvider
Overrides:
nextTimestamp in class org.hibernate.cache.TreeCacheProvider

start

public void start(Properties properties)
Find the underlying JBoss Cache TreeCache instance.

Specified by:
start in interface org.hibernate.cache.CacheProvider
Overrides:
start in class org.hibernate.cache.TreeCacheProvider
Parameters:
properties - All current config settings. If #HIBERNATE_CACHE_OBJECT_NAME_PROPERTY is provided, the value will be the expected name of the cache; otherwise #DEFAULT_MBEAN_OBJECT_NAME will be used.
Throws:
org.hibernate.cache.CacheException - Indicates a problem preparing cache for use.

stop

public void stop()
Specified by:
stop in interface org.hibernate.cache.CacheProvider
Overrides:
stop in class org.hibernate.cache.TreeCacheProvider

isOptimistic

public boolean isOptimistic()

getUnderlyingCache

public org.jboss.cache.TreeCache getUnderlyingCache()
Overrides:
getUnderlyingCache in class org.hibernate.cache.TreeCacheProvider

getTransactionManager

protected TransactionManager getTransactionManager(Properties properties)


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