Package com.tangosol.net
Class SingletonCacheFactoryBuilder
- java.lang.Object
-
- com.tangosol.net.ScopedCacheFactoryBuilder
-
- com.tangosol.net.SingletonCacheFactoryBuilder
-
- All Implemented Interfaces:
CacheFactoryBuilder,SessionProvider,Comparable<SessionProvider>
public class SingletonCacheFactoryBuilder extends ScopedCacheFactoryBuilder
Implementation ofCacheFactoryBuilderthat maintains a singleConfigurableCacheFactoryinstance regardless of the requesting ClassLoader if a URI is not provided. This builder preserves behavior prior to Coherence 3.5.1.As of Coherence 3.7, this implementation no longer provides various "validation strategies". The SingletonCacheFactoryBuilder is functionally equivalent to the pre 3.7 "compatibility" mode. For more advanced usage it is recommended to configure the
ScopedCacheFactoryBuilderor, in rare cases, configure a customScopedCacheFactoryBuilderextension.- Since:
- Coherence 3.5.1
- Author:
- rhl 2009.07.14, pp 2011.01.20
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.tangosol.net.SessionProvider
SessionProvider.Context, SessionProvider.DefaultContext, SessionProvider.Option, SessionProvider.Provider, SessionProvider.Providers
-
-
Field Summary
Fields Modifier and Type Field Description protected ConfigurableCacheFactorym_ccfSingletonSingletonConfigurableCacheFactoryinstance for the default URI.-
Fields inherited from class com.tangosol.net.ScopedCacheFactoryBuilder
f_scopeResolver, m_mapByLoader, m_mapConfigByLoader
-
Fields inherited from interface com.tangosol.net.CacheFactoryBuilder
URI_DEFAULT
-
Fields inherited from interface com.tangosol.net.SessionProvider
PRIORITY
-
-
Constructor Summary
Constructors Constructor Description SingletonCacheFactoryBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ConfigurableCacheFactorygetFactory(String sConfigURI, ClassLoader loader, ParameterResolver resolver)Helper method to return aConfigurableCacheFactoryinstance for the specified URI and class loader.protected ConfigurableCacheFactorygetSingletonFactory()Return the singleton cache factory.voidrelease(ConfigurableCacheFactory factory)Release the specified ConfigurableCacheFactory.voidreleaseAll(ClassLoader loader)Release all ConfigurableCacheFactory objects for a given ClassLoader.voidsetCacheConfiguration(String sConfigURI, ClassLoader loader, XmlElement xmlConfig)Dynamically set the cache configuration for a given URI and class loader.protected voidsetSingletonFactory(ConfigurableCacheFactory ccf)Set the singleton cache factory (seegetSingletonFactory()).-
Methods inherited from class com.tangosol.net.ScopedCacheFactoryBuilder
buildFactory, buildFactory, ensureConfigCCFMap, ensureConfigMap, getConfigurableCacheFactory, getConfigurableCacheFactory, getConfigurableCacheFactory, getConfigurableCacheFactoryConfig, getScopeResolver, getXmlConfig, instantiateFactory, instantiateScopeResolver, loadConfigFromURI, resolveURI, resolveURL, setCacheConfiguration, setConfigurableCacheFactory, setXmlConfig
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.tangosol.net.CacheFactoryBuilder
createSession, releaseSession
-
Methods inherited from interface com.tangosol.net.SessionProvider
close, compareTo, createSession, createSession, createSession, createSession, getPriority
-
-
-
-
Field Detail
-
m_ccfSingleton
protected volatile ConfigurableCacheFactory m_ccfSingleton
SingletonConfigurableCacheFactoryinstance for the default URI.
-
-
Method Detail
-
getSingletonFactory
protected ConfigurableCacheFactory getSingletonFactory()
Return the singleton cache factory. A singleton cache factory is an unnamed configurable cache factory that does not depend on a class loader.- Returns:
- the singleton cache factory
-
setSingletonFactory
protected void setSingletonFactory(ConfigurableCacheFactory ccf)
Set the singleton cache factory (seegetSingletonFactory()).- Parameters:
ccf- the singleton configurable cache factory
-
setCacheConfiguration
public void setCacheConfiguration(String sConfigURI, ClassLoader loader, XmlElement xmlConfig)
Dynamically set the cache configuration for a given URI and class loader. If a ConfigurableCacheFactory for the given URI and class loader already exists, the factory will be released.- Specified by:
setCacheConfigurationin interfaceCacheFactoryBuilder- Overrides:
setCacheConfigurationin classScopedCacheFactoryBuilder- Parameters:
sConfigURI- the configuration URI; must not be nullloader- class loader for which the configuration should be used; must not be nullxmlConfig- cache configuration in xml element format
-
releaseAll
public void releaseAll(ClassLoader loader)
Release all ConfigurableCacheFactory objects for a given ClassLoader.- Specified by:
releaseAllin interfaceCacheFactoryBuilder- Overrides:
releaseAllin classScopedCacheFactoryBuilder- Parameters:
loader- the class loader for which all associated cache factories should be released
-
release
public void release(ConfigurableCacheFactory factory)
Release the specified ConfigurableCacheFactory.- Specified by:
releasein interfaceCacheFactoryBuilder- Overrides:
releasein classScopedCacheFactoryBuilder- Parameters:
factory- the ConfigurableCacheFactory to release
-
getFactory
protected ConfigurableCacheFactory getFactory(String sConfigURI, ClassLoader loader, ParameterResolver resolver)
Helper method to return aConfigurableCacheFactoryinstance for the specified URI and class loader.- Overrides:
getFactoryin classScopedCacheFactoryBuilder- Parameters:
sConfigURI- the configuration URI to return aConfigurableCacheFactoryforloader- the loader to return a CCF for- Returns:
- a
ConfigurableCacheFactoryinstance
-
-