public interface CacheManager
Modifier and Type | Method and Description |
---|---|
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. |
<K,V> Cache<K,V> |
createCache(java.lang.String alias,
CacheConfiguration<K,V> config)
|
<K,V> Cache<K,V> |
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. |
RuntimeConfiguration |
getRuntimeConfiguration()
Returns the current
RuntimeConfiguration used by this CacheManager |
Status |
getStatus()
Returns the current
Status for this CacheManager |
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 |
removeCache(java.lang.String alias)
Removes the
Cache associated with the alias provided, if oe is known. |
<K,V> Cache<K,V> createCache(java.lang.String alias, CacheConfiguration<K,V> config)
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 createCache
java.lang.IllegalArgumentException
- If there is already a cache registered with the given alias.java.lang.IllegalStateException
- If the cache creation fails<K,V> Cache<K,V> getCache(java.lang.String alias, java.lang.Class<K> keyType, java.lang.Class<V> valueType)
Cache
associated with the given alias, if one is known.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 classCache
associated with the given alias, null
if no association existsjava.lang.IllegalArgumentException
- If the keyType or valueType do not match the ones with which the Cache
was createdvoid removeCache(java.lang.String alias)
Cache
associated with the alias provided, if oe is known.
When the cache is removed, it will release all resources it used.alias
- the alias for which to remove the Cache
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).
java.lang.IllegalStateException
- if the CacheManager isn't in Status.UNINITIALIZED
stateStateTransitionException
- if the CacheManager couldn't be made Status.AVAILABLE
java.lang.RuntimeException
- if any exception is thrown, but still results in the CacheManager transitioning to Status.AVAILABLE
void close()
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).
StateTransitionException
- if the CacheManager couldn't be cleanly made
Status.UNINITIALIZED
,
wrapping the first exception encounteredjava.lang.RuntimeException
- if any exception is thrown, like from ListenersStatus getStatus()
Status
for this CacheManagerStatus
RuntimeConfiguration getRuntimeConfiguration()
RuntimeConfiguration
used by this CacheManager