public class SharedCacheInstanceManager extends Object implements CacheInstanceManager
CacheInstanceManager
implementation where we use a single JBoss Cache
instance for each type of region. If operating on a cluster, the cache must
be configured for REPL_SYNC if query caching is enabled. If query caching
is not used, REPL_SYNC or INVALIDATION_SYNC are valid, with
INVALIDATION_SYNC preferred.Modifier and Type | Field and Description |
---|---|
static String |
CACHE_RESOURCE_PROP
Classpath or filesystem resource containing JBoss Cache
configuration settings the
Cache should use. |
static String |
CHANNEL_FACTORY_RESOURCE_PROP
Classpath or filesystem resource containing JGroups protocol
stack configurations the
org.jgroups.ChannelFactory
should use. |
static String |
DEF_JGROUPS_RESOURCE
Default value for
CHANNEL_FACTORY_RESOURCE_PROP . |
static String |
DEFAULT_CACHE_RESOURCE
Default name for the JBoss Cache configuration file.
|
static String |
LEGACY_CACHE_RESOURCE_PROP
Legacy name for configuration property
CACHE_RESOURCE_PROP . |
static String |
LEGACY_CHANNEL_FACTORY_RESOURCE_PROP
Legacy name for configuration property
CHANNEL_FACTORY_RESOURCE_PROP . |
Constructor and Description |
---|
SharedCacheInstanceManager() |
SharedCacheInstanceManager(org.jboss.cache.Cache cache) |
SharedCacheInstanceManager(org.jgroups.ChannelFactory channelFactory) |
Modifier and Type | Method and Description |
---|---|
protected void |
configureTransactionManager(org.jboss.cache.Cache cache,
Settings settings,
Properties properties)
Injects the TransactionManager found via
Settings.getTransactionManagerLookup()
into the cache. |
protected org.jboss.cache.Cache |
createSharedCache(Settings settings,
Properties properties)
Create a cache using the given settings and properties.
|
org.jboss.cache.Cache |
getCollectionCacheInstance()
Retrieve a handle to the
Cache instance to be used for storing
collection data. |
org.jboss.cache.Cache |
getEntityCacheInstance()
Retrieve a handle to the
Cache instance to be used for storing
entity data. |
org.jboss.cache.Cache |
getQueryCacheInstance()
Retrieve a handle to the
Cache instance to be used for storing
query results. |
org.jboss.cache.Cache |
getTimestampsCacheInstance()
Retrieve a handle to the
Cache instance to be used for storing
timestamps. |
void |
start(Settings settings,
Properties properties)
Lifecycle callback to perform any necessary initialization of the
CacheInstanceManager.
|
void |
stop()
Lifecycle callback to perform any necessary cleanup of the underlying
CacheInstanceManager.
|
protected void |
stopSharedCache(org.jboss.cache.Cache cache)
Stops the shared cache.
|
public static final String CACHE_RESOURCE_PROP
Cache
should use.DEFAULT_CACHE_RESOURCE
,
Constant Field Valuespublic static final String LEGACY_CACHE_RESOURCE_PROP
CACHE_RESOURCE_PROP
.DEFAULT_CACHE_RESOURCE
,
Constant Field Valuespublic static final String DEFAULT_CACHE_RESOURCE
public static final String CHANNEL_FACTORY_RESOURCE_PROP
org.jgroups.ChannelFactory
should use.DEF_JGROUPS_RESOURCE
,
Constant Field Valuespublic static final String LEGACY_CHANNEL_FACTORY_RESOURCE_PROP
CHANNEL_FACTORY_RESOURCE_PROP
.DEF_JGROUPS_RESOURCE
,
Constant Field Valuespublic static final String DEF_JGROUPS_RESOURCE
CHANNEL_FACTORY_RESOURCE_PROP
. Specifies
the "jgroups-stacks.xml" file in this package.public SharedCacheInstanceManager()
public SharedCacheInstanceManager(org.jgroups.ChannelFactory channelFactory)
public SharedCacheInstanceManager(org.jboss.cache.Cache cache)
public org.jboss.cache.Cache getEntityCacheInstance()
Cache
instance to be used for storing
entity data.getEntityCacheInstance
in interface CacheInstanceManager
public org.jboss.cache.Cache getCollectionCacheInstance()
Cache
instance to be used for storing
collection data.getCollectionCacheInstance
in interface CacheInstanceManager
public org.jboss.cache.Cache getQueryCacheInstance()
Cache
instance to be used for storing
query results.getQueryCacheInstance
in interface CacheInstanceManager
public void start(Settings settings, Properties properties) throws CacheException
SessionFactoryImpl
.start
in interface CacheInstanceManager
settings
- The settings in effect.properties
- The defined cfg propertiesCacheException
- Indicates problems starting the L2 cache impl; considered as
a sign to stop SessionFactory
building.public org.jboss.cache.Cache getTimestampsCacheInstance()
Cache
instance to be used for storing
timestamps.getTimestampsCacheInstance
in interface CacheInstanceManager
public void stop()
SessionFactory.close()
.stop
in interface CacheInstanceManager
protected org.jboss.cache.Cache createSharedCache(Settings settings, Properties properties)
settings
- The Hibernate settingsproperties
- The configuration propertiesprotected void configureTransactionManager(org.jboss.cache.Cache cache, Settings settings, Properties properties)
Settings.getTransactionManagerLookup()
into the cache.cache
- The cache instancesettings
- The Hibernate settingsproperties
- The configuration propertiesCacheException
- if cache
is already started and is
configured with a different TransactionManager
than the one we would injectprotected void stopSharedCache(org.jboss.cache.Cache cache)
cache
- the shared cacheCopyright © 2002-2014 Red Hat Middleware, LLC. All Rights Reserved