Skip navigation links

Oracle® Coherence Java API Reference
Release 12.1.2.0.3

E26043-02


com.tangosol.net
Class SingletonCacheFactoryBuilder

java.lang.Object
  extended by com.tangosol.net.ScopedCacheFactoryBuilder
      extended by com.tangosol.net.SingletonCacheFactoryBuilder

All Implemented Interfaces:
CacheFactoryBuilder

public class SingletonCacheFactoryBuilder
extends ScopedCacheFactoryBuilder

Implementation of CacheFactoryBuilder that maintains a single ConfigurableCacheFactory 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 with a custom ScopeResolver or, in rare cases, configure a custom ScopedCacheFactoryBuilder extension.

Since:
Coherence 3.5.1
Author:
rhl 2009.07.14, pp 2011.01.20

Field Summary
protected  ConfigurableCacheFactory m_ccfSingleton
          Singleton ConfigurableCacheFactory instance for the default URI.

 

Fields inherited from class com.tangosol.net.ScopedCacheFactoryBuilder
m_mapByLoader, m_mapConfigByLoader, m_scopeResolver, URI_DEFAULT

 

Constructor Summary
SingletonCacheFactoryBuilder()
           

 

Method Summary
protected  ConfigurableCacheFactory getFactory(java.lang.String sConfigURI, java.lang.ClassLoader loader)
          Helper method to return a ConfigurableCacheFactory 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(java.lang.ClassLoader loader)
          Release all ConfigurableCacheFactory objects for a given ClassLoader.
 void setCacheConfiguration(java.lang.String sConfigURI, java.lang.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 (see getSingletonFactory()).

 

Methods inherited from class com.tangosol.net.ScopedCacheFactoryBuilder
buildFactory, configureScope, ensureConfigCCFMap, ensureConfigMap, getConfigurableCacheFactory, getConfigurableCacheFactory, getConfigurableCacheFactoryConfig, getScopeResolver, instantiateFactory, loadConfigFromURI, resolveURI, resolveURL, setCacheConfiguration, setConfigurableCacheFactory, setScopeResolver

 

Field Detail

m_ccfSingleton

protected volatile ConfigurableCacheFactory m_ccfSingleton
Singleton ConfigurableCacheFactory instance for the default URI.

Constructor Detail

SingletonCacheFactoryBuilder

public SingletonCacheFactoryBuilder()

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 (see getSingletonFactory()).
Parameters:
ccf - the singleton configurable cache factory

setCacheConfiguration

public void setCacheConfiguration(java.lang.String sConfigURI,
                                  java.lang.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 interface CacheFactoryBuilder
Overrides:
setCacheConfiguration in class ScopedCacheFactoryBuilder
Parameters:
sConfigURI - the configuration URI; must not be null
loader - class loader for which the configuration should be used; must not be null
xmlConfig - cache configuration in xml element format

releaseAll

public void releaseAll(java.lang.ClassLoader loader)
Release all ConfigurableCacheFactory objects for a given ClassLoader.
Specified by:
releaseAll in interface CacheFactoryBuilder
Overrides:
releaseAll in class ScopedCacheFactoryBuilder
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 interface CacheFactoryBuilder
Overrides:
release in class ScopedCacheFactoryBuilder
Parameters:
factory - the ConfigurableCacheFactory to release

getFactory

protected ConfigurableCacheFactory getFactory(java.lang.String sConfigURI,
                                              java.lang.ClassLoader loader)
Helper method to return a ConfigurableCacheFactory instance for the specified URI and class loader.
Overrides:
getFactory in class ScopedCacheFactoryBuilder
Parameters:
sConfigURI - the configuration URI to return a ConfigurableCacheFactory for
loader - the loader to return a CCF for
Returns:
a ConfigurableCacheFactory instance

Skip navigation links

Oracle® Coherence Java API Reference
Release 12.1.2.0.3

E26043-02


Copyright © 2000, 2014, Oracle and/or its affiliates. All rights reserved.