Package org.springframework.data.gemfire
Class CacheFactoryBean
java.lang.Object
org.springframework.data.gemfire.support.AbstractFactoryBeanSupport<GemFireCache>
org.springframework.data.gemfire.AbstractBasicCacheFactoryBean
org.springframework.data.gemfire.AbstractConfigurableCacheFactoryBean
org.springframework.data.gemfire.AbstractResolvableCacheFactoryBean
org.springframework.data.gemfire.CacheFactoryBean
- All Implemented Interfaces:
Aware,BeanClassLoaderAware,BeanFactoryAware,BeanNameAware,DisposableBean,FactoryBean<GemFireCache>,InitializingBean,Phased,PersistenceExceptionTranslator
- Direct Known Subclasses:
ClientCacheFactoryBean
Spring
FactoryBean used to construct, configure and initialize a peer Cache instance.
Allows either the retrieval of an existing, open Cache or the creation of a new Cache.- Author:
- Costin Leau, David Turanski, John Blum, Patrick Johnson
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classNested classes/interfaces inherited from class org.springframework.data.gemfire.AbstractBasicCacheFactoryBean
AbstractBasicCacheFactoryBean.CacheFactoryInitializer<T>, AbstractBasicCacheFactoryBean.PdxConfigurer<T> -
Field Summary
Fields inherited from class org.springframework.data.gemfire.support.AbstractFactoryBeanSupport
DEFAULT_SINGLETONFields inherited from interface org.springframework.beans.factory.FactoryBean
OBJECT_TYPE_ATTRIBUTE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidApplies the compositePeerCacheConfigurersto thisCacheFactoryBeanbefore thepeer cacheis created.protected voidapplyPeerCacheConfigurers(Iterable<PeerCacheConfigurer> peerCacheConfigurers) Applies theIterableofPeerCacheConfigurersto thisCacheFactoryBeanbefore thepeer cacheis created.protected voidapplyPeerCacheConfigurers(PeerCacheConfigurer... peerCacheConfigurers) Applies the array ofPeerCacheConfigurersto thisCacheFactoryBeanbefore thepeer cacheis created.protected ObjectconfigureFactory(Object factory) Configures theCacheFactoryused to create theCache.protected CacheFactoryconfigurePdx(CacheFactory cacheFactory) Configures theCacheto use PDX serialization.protected CacheFactoryconfigureSecurity(CacheFactory cacheFactory) Configures theCachewith security.protected <T extends GemFireCache>
TcreateCache(Object factory) protected ObjectcreateFactory(Properties gemfireProperties) Constructs a new instance ofCacheFactoryinitialized with the given Apache GeodePropertiesused to construct, configure and initialize a new peerCacheinstance.protected <T extends GemFireCache>
TCalled byAbstractBasicCacheFactoryBean.fetchCache()if theGemFireCachereference returned byAbstractBasicCacheFactoryBean.getCache()is null.protected Class<? extends GemFireCache>By default, returnsGemFireCacheClass.Returns a reference to the CompositePeerCacheConfigurerused to apply additional configuration to thisCacheFactoryBeanduring Spring container initialization.Gets the value for the auto-reconnect setting.Returns theSecurityManagerused to secure this cache.Return the state of the use-shared-configuration Pivotal GemFire/Apache Geode distribution configuration setting.protected <T extends GemFireCache>
TpostProcess(T cache) Post process theGemFireCacheby loading any cache.xml file, applying custom settings specified in SDG XML configuration meta-data, and registering appropriate Transaction Listeners, Writer and JNDI settings along with JVM Heap configuration.voidsetEnableAutoReconnect(Boolean enableAutoReconnect) Controls whether auto-reconnect functionality introduced in GemFire 8 is enabled or not.voidsetGatewayConflictResolver(GatewayConflictResolver gatewayConflictResolver) Requires GemFire 7.0 or highervoidsetJndiDataSources(List<CacheFactoryBean.JndiDataSource> jndiDataSources) voidsetLockLease(Integer lockLease) Sets the number of seconds for implicit and explicit object lock leases to timeout.voidsetLockTimeout(Integer lockTimeout) Sets the number of seconds in which the implicit object lock request will timeout.voidsetMessageSyncInterval(Integer messageSyncInterval) Set for client subscription queue synchronization when this member acts as a server to clients and server redundancy is used.voidsetPeerCacheConfigurers(List<PeerCacheConfigurer> peerCacheConfigurers) Null-safe operation to set anIterableofPeerCacheConfigurersto apply additional configuration to thisCacheFactoryBeanwhen using Annotation-based configuration.voidsetPeerCacheConfigurers(PeerCacheConfigurer... peerCacheConfigurers) Null-safe operation to set an array ofPeerCacheConfigurersused to apply additional configuration to thisCacheFactoryBeanwhen using Annotation-based configuration.voidsetSearchTimeout(Integer searchTimeout) Set the number of seconds a netSearch operation can wait for data before timing out.voidsetSecurityManager(SecurityManager securityManager) Configures theSecurityManagerused to secure this cache.voidsetUseClusterConfiguration(Boolean useSharedConfiguration) Sets the state of the use-shared-configuration Pivotal GemFire/Apache Geode distribution configuration setting.Methods inherited from class org.springframework.data.gemfire.AbstractResolvableCacheFactoryBean
doGetObject, init, initializeFactory, postProcess, resolveCacheMethods inherited from class org.springframework.data.gemfire.AbstractConfigurableCacheFactoryBean
afterPropertiesSet, destroy, getBeanFactoryLocator, getCacheXml, getOptionalBeanFactoryLocator, getOptionalCacheXml, getProperties, isCacheXmlPresent, isCacheXmlResolvableAsAFile, isUseBeanFactoryLocator, loadCacheXml, resolveProperties, setAndGetProperties, setBeanFactoryLocator, setCacheXml, setProperties, setUseBeanFactoryLocatorMethods inherited from class org.springframework.data.gemfire.AbstractBasicCacheFactoryBean
close, configureHeapPercentages, configureOffHeapPercentages, configurePdx, fetchCache, getCache, getCacheFactoryInitializer, getCopyOnRead, getCriticalHeapPercentage, getCriticalOffHeapPercentage, getEvictionHeapPercentage, getEvictionOffHeapPercentage, getObject, getObjectType, getOptionalCache, getPdxDiskStoreName, getPdxIgnoreUnreadFields, getPdxPersistent, getPdxReadSerialized, getPdxSerializer, getPhase, getTransactionListeners, getTransactionWriter, isClose, isCopyOnRead, isNotClosed, registerTransactionListeners, registerTransactionWriter, setCache, setCacheFactoryInitializer, setClose, setCopyOnRead, setCriticalHeapPercentage, setCriticalOffHeapPercentage, setEvictionHeapPercentage, setEvictionOffHeapPercentage, setPdxDiskStoreName, setPdxIgnoreUnreadFields, setPdxPersistent, setPdxReadSerialized, setPdxSerializer, setPhase, setTransactionListeners, setTransactionWriter, translateExceptionIfPossibleMethods inherited from class org.springframework.data.gemfire.support.AbstractFactoryBeanSupport
getBeanClassLoader, getBeanFactory, getBeanName, getLog, getOptionalLog, isDebugLoggingEnabled, isErrorLoggingEnabled, isInfoLoggingEnabled, isSingleton, isWarnLoggingEnabled, logDebug, logDebug, logError, logError, logInfo, logInfo, logWarning, logWarning, newLog, setBeanClassLoader, setBeanFactory, setBeanName
-
Constructor Details
-
CacheFactoryBean
public CacheFactoryBean()
-
-
Method Details
-
applyCacheConfigurers
protected void applyCacheConfigurers()Applies the compositePeerCacheConfigurersto thisCacheFactoryBeanbefore thepeer cacheis created.- Specified by:
applyCacheConfigurersin classAbstractBasicCacheFactoryBean- See Also:
-
applyPeerCacheConfigurers
Applies the array ofPeerCacheConfigurersto thisCacheFactoryBeanbefore thepeer cacheis created.- Parameters:
peerCacheConfigurers- array ofPeerCacheConfigurersapplied to thisCacheFactoryBean.- See Also:
-
applyPeerCacheConfigurers
Applies theIterableofPeerCacheConfigurersto thisCacheFactoryBeanbefore thepeer cacheis created.- Parameters:
peerCacheConfigurers-IterableofPeerCacheConfigurersapplied to thisCacheFactoryBean.- See Also:
-
doFetchCache
Description copied from class:AbstractBasicCacheFactoryBeanCalled byAbstractBasicCacheFactoryBean.fetchCache()if theGemFireCachereference returned byAbstractBasicCacheFactoryBean.getCache()is null. This method is typically implemented by callingCacheFactory.getAnyInstance()orClientCacheFactory.getAnyInstance()depending on theGemFireCachetype declared and used in the Spring application.- Specified by:
doFetchCachein classAbstractBasicCacheFactoryBean- Type Parameters:
T- parameterizedClasstype extendingGemFireCache.- Returns:
- a (existing) reference to a
GemFireCacheinstance. - See Also:
-
doGetObjectType
Description copied from class:AbstractBasicCacheFactoryBeanBy default, returnsGemFireCacheClass.- Overrides:
doGetObjectTypein classAbstractBasicCacheFactoryBean- Returns:
GemFireCacheClassby default.- See Also:
-
createFactory
Constructs a new instance ofCacheFactoryinitialized with the given Apache GeodePropertiesused to construct, configure and initialize a new peerCacheinstance.- Specified by:
createFactoryin classAbstractResolvableCacheFactoryBean- Parameters:
gemfireProperties-Propertiesused by theCacheFactoryto configure the peerCache.- Returns:
- a new instance of
CacheFactoryinitialized with the given Apache GeodeProperties. - See Also:
-
configureFactory
Configures theCacheFactoryused to create theCache.- Overrides:
configureFactoryin classAbstractResolvableCacheFactoryBean- Parameters:
factory-CacheFactoryused to create theCache.- Returns:
- the configured
CacheFactory. - See Also:
-
configurePdx
Configures theCacheto use PDX serialization.- Parameters:
cacheFactory-CacheFactoryto configure with PDX.- Returns:
- the given
CacheFactory. - See Also:
-
configureSecurity
Configures theCachewith security.- Parameters:
cacheFactory-CacheFactoryused to configure the peerCacheinstance with security.- Returns:
- the given
CacheFactory. - See Also:
-
createCache
- Specified by:
createCachein classAbstractResolvableCacheFactoryBean- Type Parameters:
T-sub-typeofGemFireCache.- Parameters:
factory- instance ofCacheFactory.- Returns:
- a new instance of
Cachecreated by the providedfactory. - See Also:
-
postProcess
Post process theGemFireCacheby loading any cache.xml file, applying custom settings specified in SDG XML configuration meta-data, and registering appropriate Transaction Listeners, Writer and JNDI settings along with JVM Heap configuration.- Overrides:
postProcessin classAbstractResolvableCacheFactoryBean- Type Parameters:
T- parameterizedClasstype extendingGemFireCache.- Parameters:
cache-GemFireCacheto post process.- Returns:
- the given
GemFireCache. - See Also:
-
AbstractConfigurableCacheFactoryBean.loadCacheXml(GemFireCache)GemFireCache.loadCacheXml(java.io.InputStream)AbstractBasicCacheFactoryBean.configureHeapPercentages(org.apache.geode.cache.GemFireCache)AbstractBasicCacheFactoryBean.configureOffHeapPercentages(GemFireCache)registerJndiDataSources(GemFireCache)AbstractBasicCacheFactoryBean.registerTransactionListeners(org.apache.geode.cache.GemFireCache)AbstractBasicCacheFactoryBean.registerTransactionWriter(org.apache.geode.cache.GemFireCache)
-
getCompositePeerCacheConfigurer
Returns a reference to the CompositePeerCacheConfigurerused to apply additional configuration to thisCacheFactoryBeanduring Spring container initialization.- Returns:
- the Composite
PeerCacheConfigurer. - See Also:
-
setEnableAutoReconnect
Controls whether auto-reconnect functionality introduced in GemFire 8 is enabled or not.- Parameters:
enableAutoReconnect- a boolean value to enable/disable auto-reconnect functionality.- Since:
- GemFire 8.0
-
getEnableAutoReconnect
Gets the value for the auto-reconnect setting.- Returns:
- a boolean value indicating whether auto-reconnect was specified (non-null) and whether it was enabled or not.
-
setGatewayConflictResolver
Requires GemFire 7.0 or higher- Parameters:
gatewayConflictResolver- defined as Object in the signature for backward compatibility with Gemfire 6 compatibility. This must be an instance ofGatewayConflictResolver
-
getGatewayConflictResolver
- Returns:
- the gatewayConflictResolver
-
setJndiDataSources
- Parameters:
jndiDataSources- the list of configured JndiDataSources to use with this Cache.
-
getJndiDataSources
- Returns:
- the list of configured JndiDataSources.
-
setLockLease
Sets the number of seconds for implicit and explicit object lock leases to timeout.- Parameters:
lockLease- an integer value indicating the object lock lease timeout.
-
getLockLease
- Returns:
- the lockLease
-
setLockTimeout
Sets the number of seconds in which the implicit object lock request will timeout.- Parameters:
lockTimeout- an integer value specifying the object lock request timeout.
-
getLockTimeout
- Returns:
- the lockTimeout
-
setMessageSyncInterval
Set for client subscription queue synchronization when this member acts as a server to clients and server redundancy is used. Sets the frequency (in seconds) at which the primary server sends messages to its secondary servers to remove queued events that have already been processed by the clients.- Parameters:
messageSyncInterval- an integer value specifying the number of seconds in which the primary server sends messages to secondary servers.
-
getMessageSyncInterval
- Returns:
- the messageSyncInterval
-
setPeerCacheConfigurers
Null-safe operation to set an array ofPeerCacheConfigurersused to apply additional configuration to thisCacheFactoryBeanwhen using Annotation-based configuration.- Parameters:
peerCacheConfigurers- array ofPeerCacheConfigurersused to apply additional configuration to thisCacheFactoryBean.- See Also:
-
setPeerCacheConfigurers
Null-safe operation to set anIterableofPeerCacheConfigurersto apply additional configuration to thisCacheFactoryBeanwhen using Annotation-based configuration.- Parameters:
peerCacheConfigurers-IterableofPeerCacheConfigurersused to apply additional configuration to thisCacheFactoryBean.- See Also:
-
setSearchTimeout
Set the number of seconds a netSearch operation can wait for data before timing out.- Parameters:
searchTimeout- an integer value indicating the netSearch timeout value.
-
getSearchTimeout
- Returns:
- the searchTimeout
-
setSecurityManager
Configures theSecurityManagerused to secure this cache.- Parameters:
securityManager-SecurityManagerused to secure this cache.- See Also:
-
getSecurityManager
Returns theSecurityManagerused to secure this cache.- Returns:
- the
SecurityManagerused to secure this cache. - See Also:
-
setUseClusterConfiguration
Sets the state of the use-shared-configuration Pivotal GemFire/Apache Geode distribution configuration setting.- Parameters:
useSharedConfiguration- boolean value to set the use-shared-configuration Pivotal GemFire/Apache Geode distribution configuration setting.
-
getUseClusterConfiguration
Return the state of the use-shared-configuration Pivotal GemFire/Apache Geode distribution configuration setting.- Returns:
- the current boolean value for the use-shared-configuration Pivotal GemFire/Apache Geode distribution configuration setting.
-