public class CompositeCacheManager extends java.lang.Object implements IRemoteCacheConstants, java.io.Serializable, ICompositeCacheManager, IShutdownObservable
The composite cache manager is responsible for creating / configuring cache regions. It serves as a factory for the ComositeCache class. The CompositeCache is the core of JCS, the hub for various auxiliaries.
It is recommended that you use the JCS convenience class for all cache access.
Modifier and Type | Field and Description |
---|---|
protected java.util.Hashtable |
auxiliaryAttributeRegistry
Used to keep track of attributes for auxiliaries.
|
protected java.util.Hashtable |
auxiliaryFactoryRegistry
Used to keep track of configured auxiliaries
|
protected java.util.Hashtable |
caches
Caches managed by this cache manager
|
protected java.lang.String |
defaultAuxValues
The default auxiliary caches to be used if not preconfigured
|
protected ICompositeCacheAttributes |
defaultCacheAttr
Default cache attributes for this cache manager
|
protected IElementAttributes |
defaultElementAttr
Default elemeent attributes for this cache manager
|
protected static CompositeCacheManager |
instance
The Singleton Instance
|
protected java.util.Hashtable |
systemCaches
Internal system caches for this cache manager
|
CACHE_SERVER_ATTRIBUTES_PROPERTY_PREFIX, CACHE_SERVER_PREFIX, CUSTOM_RMI_SOCKET_FACTORY_PROPERTY_PREFIX, PROPERTY_PREFIX, REMOTE_ALLOW_CLUSTER_GET, REMOTE_CACHE_SERVICE_NAME, REMOTE_CACHE_SERVICE_PORT, REMOTE_CACHE_SERVICE_VAL, REMOTE_LOCAL_CLUSTER_CONSISTENCY, SOCKET_TIMEOUT_MILLIS, TOMCAT_ON, TOMCAT_XML
Modifier | Constructor and Description |
---|---|
protected |
CompositeCacheManager()
CreAtes a shutdown hook
|
Modifier and Type | Method and Description |
---|---|
void |
configure()
Configure with default properties file
|
void |
configure(java.util.Properties props)
Configure from properties object.
|
void |
configure(java.util.Properties props,
boolean useSystemProperties)
Configure from properties object, overriding with values from the system properteis if
instructed.
|
void |
configure(java.lang.String propFile)
Configure from specific properties file.
|
protected static CompositeCacheManager |
createInstance()
Simple factory method, must override in subclasses so getInstance creates / returns the
correct object.
|
void |
deregisterShutdownObserver(IShutdownObserver observer)
Deregisters the observer with the observable.
|
void |
freeCache(java.lang.String name) |
void |
freeCache(java.lang.String name,
boolean fromRemote) |
CompositeCache |
getCache(ICompositeCacheAttributes cattr)
Gets the cache attribute of the CacheHub object
|
CompositeCache |
getCache(ICompositeCacheAttributes cattr,
IElementAttributes attr)
If the cache has already been created, then the CacheAttributes and the element Attributes
will be ignored.
|
CompositeCache |
getCache(java.lang.String cacheName)
Gets the cache attribute of the CacheHub object
|
CompositeCache |
getCache(java.lang.String cacheName,
ICompositeCacheAttributes cattr)
Gets the cache attribute of the CacheHub object
|
CompositeCache |
getCache(java.lang.String cacheName,
ICompositeCacheAttributes cattr,
IElementAttributes attr)
Gets the cache attribute of the CacheHub object
|
java.lang.String[] |
getCacheNames()
Returns a list of the current cache names.
|
int |
getCacheType() |
java.util.Properties |
getConfigurationProperties()
This is exposed so other manager can get access to the props.
|
ICompositeCacheAttributes |
getDefaultCacheAttributes()
Gets the defaultCacheAttributes attribute of the CacheHub object
|
ICompositeCacheAttributes |
getDefaultCattr() |
IElementAttributes |
getDefaultElementAttributes()
Gets the defaultElementAttributes attribute of the CacheHub object
|
static CompositeCacheManager |
getInstance()
Gets the CacheHub instance.
|
static CompositeCacheManager |
getInstance(java.lang.String propsFilename)
Initializes the cache manager using the props file for the given name.
|
ICacheStats[] |
getStatistics()
This returns data gathered for all regions and all the auxiliaries they currently uses.
|
java.lang.String |
getStats()
Gets stats for debugging.
|
static CompositeCacheManager |
getUnconfiguredInstance()
Get a CacheHub instance which is not configured.
|
protected void |
incrementClients() |
void |
registerShutdownObserver(IShutdownObserver observer)
Perhaps the composite cache itself should be the observable object.
|
void |
release() |
void |
setConfigurationProperties(java.util.Properties props)
This is exposed so other manager can get access to the props.
|
void |
setDefaultCacheAttributes(ICompositeCacheAttributes icca)
Sets the defaultCacheAttributes attribute of the CacheHub object
|
void |
setDefaultElementAttributes(IElementAttributes iea)
Sets the defaultElementAttributes attribute of the CacheHub object
|
void |
shutDown()
Calls freeCache on all regions
|
protected java.util.Hashtable caches
protected java.util.Hashtable systemCaches
protected ICompositeCacheAttributes defaultCacheAttr
protected IElementAttributes defaultElementAttr
protected java.util.Hashtable auxiliaryFactoryRegistry
protected java.util.Hashtable auxiliaryAttributeRegistry
protected java.lang.String defaultAuxValues
protected static CompositeCacheManager instance
public static CompositeCacheManager getInstance()
getUnconfiguredInstance()
and then call configure()
public static CompositeCacheManager getInstance(java.lang.String propsFilename)
propsFilename
- public static CompositeCacheManager getUnconfiguredInstance()
protected static CompositeCacheManager createInstance()
public void configure()
public void configure(java.lang.String propFile)
propFile
- Path within classpath to load configuration frompublic void configure(java.util.Properties props)
This method will call confiure, instructing it to use ssytem properties as a default.
props
- public void configure(java.util.Properties props, boolean useSystemProperties)
You can override a specific value by passing in a ssytem property:
For example, you could override this value in the cache.ccf file by starting up your program with the argument: -Djcs.auxiliary.LTCP.attributes.TcpListenerPort=1111
props
- useSystemProperties
- -- if true, values starting with jcs will be put into the props
file prior to configuring the cache.public ICompositeCacheAttributes getDefaultCacheAttributes()
public void setDefaultCacheAttributes(ICompositeCacheAttributes icca)
icca
- The new defaultCacheAttributes valuepublic void setDefaultElementAttributes(IElementAttributes iea)
iea
- The new defaultElementAttributes valuepublic IElementAttributes getDefaultElementAttributes()
public CompositeCache getCache(java.lang.String cacheName)
getCache
in interface ICompositeCacheManager
cacheName
- public CompositeCache getCache(java.lang.String cacheName, ICompositeCacheAttributes cattr)
cacheName
- cattr
- public CompositeCache getCache(java.lang.String cacheName, ICompositeCacheAttributes cattr, IElementAttributes attr)
cacheName
- cattr
- attr
- public CompositeCache getCache(ICompositeCacheAttributes cattr)
cattr
- public CompositeCache getCache(ICompositeCacheAttributes cattr, IElementAttributes attr)
Overriding the default elemental attributes will require changing the way the attributes are assigned to elements. Get cache creates a cache with defaults if none are specified. We might want to create separate method for creating/getting. . .
cattr
- attr
- public void freeCache(java.lang.String name)
name
- public void freeCache(java.lang.String name, boolean fromRemote)
name
- fromRemote
- public void shutDown()
protected void incrementClients()
public void release()
public java.lang.String[] getCacheNames()
public int getCacheType()
public ICompositeCacheAttributes getDefaultCattr()
public java.lang.String getStats()
getStats
in interface ICompositeCacheManager
public ICacheStats[] getStatistics()
public void registerShutdownObserver(IShutdownObserver observer)
registerShutdownObserver
in interface IShutdownObservable
observer
- public void deregisterShutdownObserver(IShutdownObserver observer)
IShutdownObservable
deregisterShutdownObserver
in interface IShutdownObservable
observer
- public void setConfigurationProperties(java.util.Properties props)
props
- public java.util.Properties getConfigurationProperties()
getConfigurationProperties
in interface ICompositeCacheManager
Copyright © 2002-2013 Apache Software Foundation. All Rights Reserved.