Interface ConfigurableCacheFactory
-
- All Known Implementing Classes:
DefaultConfigurableCacheFactory
,ExtensibleConfigurableCacheFactory
public interface ConfigurableCacheFactory
An interface for cache factory.- Since:
- Coherence 2.2
- Author:
- gg 2003.05.26, jh 2006.06.28
- See Also:
DefaultConfigurableCacheFactory
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
activate()
Activate prepares the factory to be used within a container and should be called before any other factory method.void
destroyCache(NamedCache<?,?> cache)
Release and destroy this instance of NamedCache.void
destroyTopic(NamedTopic<?> topic)
Release and destroy this instance ofNamedTopic
.void
dispose()
Dispose of this factory.default <K,V>
NamedCache<K,V>ensureCache(String sCacheName, ClassLoader loader)
Ensure an cache for the given name and classloader (using raw types).<K,V>
NamedCache<K,V>ensureCache(String sCacheName, ClassLoader loader, NamedMap.Option... options)
Ensure an cache for the given name, classloader and options.Service
ensureService(String sServiceName)
Ensure a service for the given name.default <V> NamedTopic<V>
ensureTopic(String sName, NamedCollection.Option... options)
Ensure an Object-based topic for the given name.<V> NamedTopic<V>
ensureTopic(String sName, ClassLoader loader, NamedCollection.Option... options)
Ensure an Object-based topic for the given name.default <K,V>
NamedCache<K,V>ensureTypedCache(String sCacheName, ClassLoader loader, TypeAssertion<K,V> assertion)
Ensure a cache for the given name satisfying the specified type assertion.InterceptorRegistry
getInterceptorRegistry()
Return theInterceptorRegistry
for this factory.ResourceRegistry
getResourceRegistry()
Return theResourceRegistry
for this factory.default String
getScopeName()
Return the scope name of this cache factory, if available.default boolean
isActive()
Returnstrue
if thisConfigurableCacheFactory
is activated.boolean
isCacheActive(String sCacheName, ClassLoader loader)
Validate whether a cache with the given name is active in the context of the givenClassLoader
.default boolean
isDisposed()
Return true if this factory has been disposed via invocation ofdispose()
.boolean
isTopicActive(String sTopicName, ClassLoader loader)
Validate whether a topic with the given name is active in the context of the givenClassLoader
.void
releaseCache(NamedCache<?,?> cache)
Release a cache and its associated resources.void
releaseTopic(NamedTopic<?> topic)
Release aNamedTopic
and its associated resources.
-
-
-
Method Detail
-
activate
void activate()
Activate prepares the factory to be used within a container and should be called before any other factory method.- Since:
- Coherence 12.1.2
-
isActive
default boolean isActive()
Returnstrue
if thisConfigurableCacheFactory
is activated.- Returns:
true
if thisConfigurableCacheFactory
is activated
-
dispose
void dispose()
Dispose of this factory. This will stop all services that were started by this factory and dispose of all resources registered viagetResourceRegistry()
. This factory may not be used after invoking dispose.- Since:
- Coherence 12.1.2
-
isDisposed
default boolean isDisposed()
Return true if this factory has been disposed via invocation ofdispose()
.- Returns:
- true if this factory has been disposed
-
ensureCache
default <K,V> NamedCache<K,V> ensureCache(String sCacheName, ClassLoader loader)
Ensure an cache for the given name and classloader (using raw types).- Parameters:
sCacheName
- the cache nameloader
- ClassLoader that should be used to deserialize objects in the cache- Returns:
- a NamedCache created
-
ensureCache
<K,V> NamedCache<K,V> ensureCache(String sCacheName, ClassLoader loader, NamedMap.Option... options)
Ensure an cache for the given name, classloader and options.- Parameters:
sCacheName
- the cache nameloader
- ClassLoader that should be used to deserialize objects in the cacheoptions
- theNamedMap.Option
s- Returns:
- a NamedCache created
-
ensureTypedCache
default <K,V> NamedCache<K,V> ensureTypedCache(String sCacheName, ClassLoader loader, TypeAssertion<K,V> assertion)
Ensure a cache for the given name satisfying the specified type assertion.- Parameters:
sCacheName
- the cache nameloader
- theClassLoader
to use for deserializing cache entriesassertion
- theTypeAssertion
for asserting the type of keys and values for the NamedCache- Returns:
- a NamedCache created
- Since:
- Coherence 12.2.1
-
releaseCache
void releaseCache(NamedCache<?,?> cache)
Release a cache and its associated resources.Releasing a cache makes it no longer usable, but does not affect the cache itself. In other words, all other references to the cache will still be valid, and the cache data is not affected by releasing the reference. Any attempt to use the released cache reference afterword will result in an exception.
- Parameters:
cache
- the cache to release- Since:
- Coherence 3.5.1
-
destroyCache
void destroyCache(NamedCache<?,?> cache)
Release and destroy this instance of NamedCache.Warning: This method is used to completely destroy the specified cache across the cluster. All references in the entire cluster to this cache will be invalidated, the cached data will be cleared, and all internal and associated resources will be released.
- Parameters:
cache
- the cache to release- Since:
- Coherence 3.5.1
-
ensureTopic
default <V> NamedTopic<V> ensureTopic(String sName, NamedCollection.Option... options)
Ensure an Object-based topic for the given name.- Parameters:
sName
- the topic nameoptions
- theNamedCollection.Option
s to control any optional topic configuration- Returns:
- a NamedTopic created
- Since:
- Coherence 14.1.1
-
ensureTopic
<V> NamedTopic<V> ensureTopic(String sName, ClassLoader loader, NamedCollection.Option... options)
Ensure an Object-based topic for the given name.- Parameters:
sName
- the topic nameloader
- ClassLoader that should be used to deserialize objects in the cacheoptions
- theNamedCollection.Option
s to control any optional topic configuration- Returns:
- a NamedTopic created
- Since:
- Coherence 14.1.1
-
releaseTopic
void releaseTopic(NamedTopic<?> topic)
Release aNamedTopic
and its associated resources.Releasing a topic makes it no longer usable, but does not affect the topic itself. In other words, all other references to the topic will still be valid, and the topic data is not affected by releasing the reference. Any attempt to use the released topic reference afterword will result in an exception.
- Parameters:
topic
- the topic to release- Since:
- Coherence 14.1.1
-
destroyTopic
void destroyTopic(NamedTopic<?> topic)
Release and destroy this instance ofNamedTopic
.Warning: This method is used to completely destroy the specified topic across the cluster. All references in the entire cluster to this topic will be invalidated, the topic data will be cleared, and all internal and associated resources will be released.
- Parameters:
topic
- the topic to release- Since:
- Coherence 14.1.1
-
ensureService
Service ensureService(String sServiceName)
Ensure a service for the given name.- Parameters:
sServiceName
- the service name- Returns:
- a Service created
-
getInterceptorRegistry
InterceptorRegistry getInterceptorRegistry()
Return theInterceptorRegistry
for this factory.EventInterceptor
s registered with this registry will be scoped to services and caches created by this factory.- Returns:
- the
InterceptorRegistry
for this factory - Since:
- Coherence 12.1.2
-
getResourceRegistry
ResourceRegistry getResourceRegistry()
Return theResourceRegistry
for this factory.- Returns:
- the ResourceRegistry for this factory
- Since:
- Coherence 12.1.2
-
isCacheActive
boolean isCacheActive(String sCacheName, ClassLoader loader)
Validate whether a cache with the given name is active in the context of the givenClassLoader
. The ClassLoader should be the same as provided to a previous call toensureCache(String, ClassLoader, NamedCache.Option...)
.- Parameters:
sCacheName
- the cache nameloader
- the ClassLoader used to originally obtain the cache- Returns:
- true if cache is active in context of the provided ClassLoader
- Since:
- Coherence 12.2.1
-
isTopicActive
boolean isTopicActive(String sTopicName, ClassLoader loader)
Validate whether a topic with the given name is active in the context of the givenClassLoader
. The ClassLoader should be the same as provided to a previous call toensureTopic(String, ClassLoader, NamedTopic.Option...)
.- Parameters:
sTopicName
- the topic nameloader
- the ClassLoader used to originally obtain the topic- Returns:
- true if topic is active in context of the provided ClassLoader
- Since:
- Coherence 20.12
-
getScopeName
default String getScopeName()
Return the scope name of this cache factory, if available.- Returns:
- the scope name of this cache factory, if available;
null
otherwise
-
-