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 ofCacheFactoryBuilder
that maintains a singleConfigurableCacheFactory
instance 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
ScopedCacheFactoryBuilder
or, in rare cases, configure a customScopedCacheFactoryBuilder
extension.- 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 ConfigurableCacheFactory
m_ccfSingleton
SingletonConfigurableCacheFactory
instance 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 ConfigurableCacheFactory
getFactory(String sConfigURI, ClassLoader loader, ParameterResolver resolver)
Helper method to return aConfigurableCacheFactory
instance for the specified URI and class loader.protected ConfigurableCacheFactory
getSingletonFactory()
Return the singleton cache factory.void
release(ConfigurableCacheFactory factory)
Release the specified ConfigurableCacheFactory.void
releaseAll(ClassLoader loader)
Release all ConfigurableCacheFactory objects for a given ClassLoader.void
setCacheConfiguration(String sConfigURI, ClassLoader loader, XmlElement xmlConfig)
Dynamically set the cache configuration for a given URI and class loader.protected void
setSingletonFactory(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
SingletonConfigurableCacheFactory
instance 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:
setCacheConfiguration
in interfaceCacheFactoryBuilder
- Overrides:
setCacheConfiguration
in 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:
releaseAll
in interfaceCacheFactoryBuilder
- Overrides:
releaseAll
in 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:
release
in interfaceCacheFactoryBuilder
- Overrides:
release
in classScopedCacheFactoryBuilder
- Parameters:
factory
- the ConfigurableCacheFactory to release
-
getFactory
protected ConfigurableCacheFactory getFactory(String sConfigURI, ClassLoader loader, ParameterResolver resolver)
Helper method to return aConfigurableCacheFactory
instance for the specified URI and class loader.- Overrides:
getFactory
in classScopedCacheFactoryBuilder
- Parameters:
sConfigURI
- the configuration URI to return aConfigurableCacheFactory
forloader
- the loader to return a CCF for- Returns:
- a
ConfigurableCacheFactory
instance
-
-