|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.ehcache.core.EhcacheManager
public class EhcacheManager
Implementation class for the CacheManager
and PersistentCacheManager
Ehcache
users should not have to depend on this type but rely exclusively on the api types in package
org.ehcache
.
Field Summary | |
---|---|
protected ServiceLocator |
serviceLocator
|
Constructor Summary | |
---|---|
EhcacheManager(Configuration config)
|
|
EhcacheManager(Configuration config,
java.util.Collection<Service> services)
|
|
EhcacheManager(Configuration config,
java.util.Collection<Service> services,
boolean useLoaderInAtomics)
|
Method Summary | ||
---|---|---|
void |
close()
Releases all data held in Cache instances managed by this CacheManager , as well as all
Service this instance provides to managed Cache instances. |
|
protected void |
closeEhcache(java.lang.String alias,
InternalCache<?,?> ehcache)
Perform cache closure actions specific to a cache manager implementation. |
|
|
createCache(java.lang.String alias,
CacheConfiguration<K,V> config)
Creates a Cache in this CacheManager according to the specified CacheConfiguration . |
|
void |
deregisterListener(CacheManagerListener listener)
|
|
void |
destroyCache(java.lang.String alias)
Destroys all data persistent data associated with the aliased Cache instance managed
by this CacheManager |
|
|
getCache(java.lang.String alias,
java.lang.Class<K> keyType,
java.lang.Class<V> valueType)
Retrieves the Cache associated with the given alias, if one is known. |
|
protected org.slf4j.Logger |
getLogger()
Gets the class-identified Logger instance. |
|
RuntimeConfiguration |
getRuntimeConfiguration()
Returns the current RuntimeConfiguration used by this CacheManager |
|
Status |
getStatus()
Returns the current Status for this CacheManager |
|
protected
|
getStore(java.lang.String alias,
CacheConfiguration<K,V> config,
java.lang.Class<K> keyType,
java.lang.Class<V> valueType,
java.util.Collection<ServiceConfiguration<?>> serviceConfigs,
java.util.List<LifeCycled> lifeCycledList)
Instantiates a Store used for the cache data. |
|
void |
init()
Attempts at having this CacheManager go to Status.AVAILABLE , starting all
Service instances managed by this CacheManager , as well
as all Cache pre registered with it. |
|
void |
registerListener(CacheManagerListener listener)
|
|
protected void |
removeAndCloseWithoutNotice(java.lang.String alias)
Removes and closes a cache without performing CacheManagerListener.cacheRemoved(String, Cache)
notifications. |
|
void |
removeCache(java.lang.String alias)
Removes the Cache associated with the alias provided, if oe is known. |
|
Maintainable |
toMaintenance()
Lets you manipulate the persistent data structures for this PersistentCacheManager |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final ServiceLocator serviceLocator
Constructor Detail |
---|
public EhcacheManager(Configuration config)
public EhcacheManager(Configuration config, java.util.Collection<Service> services)
public EhcacheManager(Configuration config, java.util.Collection<Service> services, boolean useLoaderInAtomics)
Method Detail |
---|
protected org.slf4j.Logger getLogger()
Logger
instance.
Logger
to usepublic <K,V> Cache<K,V> getCache(java.lang.String alias, java.lang.Class<K> keyType, java.lang.Class<V> valueType)
CacheManager
Cache
associated with the given alias, if one is known.
getCache
in interface CacheManager
K
- the type of the keys used to access data within this cacheV
- the type of the values held within this cachealias
- the alias under which to look the Cache
upkeyType
- the Cache
key classvalueType
- the Cache
value class
Cache
associated with the given alias, null
if no association existspublic void removeCache(java.lang.String alias)
CacheManager
Cache
associated with the alias provided, if oe is known.
When the cache is removed, it will release all resources it used.
removeCache
in interface CacheManager
alias
- the alias for which to remove the Cache
protected void closeEhcache(java.lang.String alias, InternalCache<?,?> ehcache)
InternalCache
instance is closed.
alias
- the cache aliasehcache
- the InternalCache
instance for the cache to closepublic <K,V> Cache<K,V> createCache(java.lang.String alias, CacheConfiguration<K,V> config) throws java.lang.IllegalArgumentException
CacheManager
Cache
in this CacheManager
according to the specified CacheConfiguration
.
createCache
in interface CacheManager
K
- the type of the keys used to access data within this cacheV
- the type of the values held within this cachealias
- the alias under which the cache will be createdconfig
- the configuration of the cache to create
Cache
java.lang.IllegalArgumentException
- If there is already a cache registered with the given alias.protected <K,V> Store<K,V> getStore(java.lang.String alias, CacheConfiguration<K,V> config, java.lang.Class<K> keyType, java.lang.Class<V> valueType, java.util.Collection<ServiceConfiguration<?>> serviceConfigs, java.util.List<LifeCycled> lifeCycledList)
Store
used for the cache data.
K
- the cache key typeV
- the cache value typealias
- the alias assigned to the cacheconfig
- the configuration used for the cachekeyType
- the cache key typevalueType
- the cache value typeserviceConfigs
- the List
of ServiceConfiguration
instances available to the cache;
this list may be augmented by the implementation of this methodlifeCycledList
- the List
of LifeCycled
instances used to manage components of the
cache; this list may be augmented by the implementation of this method
Store
instance used to create the cachepublic void registerListener(CacheManagerListener listener)
registerListener
in interface InternalCacheManager
public void deregisterListener(CacheManagerListener listener)
deregisterListener
in interface InternalCacheManager
public void init()
Status.AVAILABLE
, starting all
Service
instances managed by this CacheManager
, as well
as all Cache
pre registered with it.
Should this throw, while the CacheManager isn't yet Status.AVAILABLE
, it will go back
to Status.UNINITIALIZED
properly (i.e. closing all services it already started,
but which in turn may fail too).
init
in interface CacheManager
public Status getStatus()
CacheManager
Status
for this CacheManager
getStatus
in interface CacheManager
Status
public void close()
CacheManager
Cache
instances managed by this CacheManager
, as well as all
Service
this instance provides to managed Cache
instances.
Should this throw, while the CacheManager isn't yet Status.UNINITIALIZED
, it will keep on
trying to go to Status.UNINITIALIZED
properly (i.e. closing all other services it didn't yet stop).
close
in interface CacheManager
public RuntimeConfiguration getRuntimeConfiguration()
CacheManager
RuntimeConfiguration
used by this CacheManager
getRuntimeConfiguration
in interface CacheManager
protected void removeAndCloseWithoutNotice(java.lang.String alias)
CacheManagerListener.cacheRemoved(String, Cache)
notifications.
alias
- the alias of the cache to removepublic void destroyCache(java.lang.String alias) throws CachePersistenceException
PersistentCacheManager
Cache
instance managed
by this CacheManager
destroyCache
in interface PersistentCacheManager
alias
- the Cache
's alias to destroy all persistent data from
CachePersistenceException
- When something goes wrong destroying the persistent datapublic Maintainable toMaintenance()
PersistentCacheManager
PersistentCacheManager
toMaintenance
in interface PersistentCacheManager
Maintainable
for this PersistentCacheManager
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |