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
Modifier and TypeClassDescriptionstatic class
static class
Nested 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_SINGLETON
Fields inherited from interface org.springframework.beans.factory.FactoryBean
OBJECT_TYPE_ATTRIBUTE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
Applies the compositePeerCacheConfigurers
to thisCacheFactoryBean
before thepeer cache
is created.protected void
applyPeerCacheConfigurers
(Iterable<PeerCacheConfigurer> peerCacheConfigurers) Applies theIterable
ofPeerCacheConfigurers
to thisCacheFactoryBean
before thepeer cache
is created.protected void
applyPeerCacheConfigurers
(PeerCacheConfigurer... peerCacheConfigurers) Applies the array ofPeerCacheConfigurers
to thisCacheFactoryBean
before thepeer cache
is created.protected Object
configureFactory
(Object factory) Configures theCacheFactory
used to create theCache
.protected CacheFactory
configurePdx
(CacheFactory cacheFactory) Configures theCache
to use PDX serialization.protected CacheFactory
configureSecurity
(CacheFactory cacheFactory) Configures theCache
with security.protected <T extends GemFireCache>
TcreateCache
(Object factory) protected Object
createFactory
(Properties gemfireProperties) Constructs a new instance ofCacheFactory
initialized with the given Apache GeodeProperties
used to construct, configure and initialize a new peerCache
instance.protected <T extends GemFireCache>
TCalled byAbstractBasicCacheFactoryBean.fetchCache()
if theGemFireCache
reference returned byAbstractBasicCacheFactoryBean.getCache()
is null.protected Class<? extends GemFireCache>
By default, returnsGemFireCache
Class
.Returns a reference to the CompositePeerCacheConfigurer
used to apply additional configuration to thisCacheFactoryBean
during Spring container initialization.Gets the value for the auto-reconnect setting.Returns theSecurityManager
used 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 theGemFireCache
by 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.void
setEnableAutoReconnect
(Boolean enableAutoReconnect) Controls whether auto-reconnect functionality introduced in GemFire 8 is enabled or not.void
setGatewayConflictResolver
(GatewayConflictResolver gatewayConflictResolver) Requires GemFire 7.0 or highervoid
setJndiDataSources
(List<CacheFactoryBean.JndiDataSource> jndiDataSources) void
setLockLease
(Integer lockLease) Sets the number of seconds for implicit and explicit object lock leases to timeout.void
setLockTimeout
(Integer lockTimeout) Sets the number of seconds in which the implicit object lock request will timeout.void
setMessageSyncInterval
(Integer messageSyncInterval) Set for client subscription queue synchronization when this member acts as a server to clients and server redundancy is used.void
setPeerCacheConfigurers
(List<PeerCacheConfigurer> peerCacheConfigurers) Null-safe operation to set anIterable
ofPeerCacheConfigurers
to apply additional configuration to thisCacheFactoryBean
when using Annotation-based configuration.void
setPeerCacheConfigurers
(PeerCacheConfigurer... peerCacheConfigurers) Null-safe operation to set an array ofPeerCacheConfigurers
used to apply additional configuration to thisCacheFactoryBean
when using Annotation-based configuration.void
setSearchTimeout
(Integer searchTimeout) Set the number of seconds a netSearch operation can wait for data before timing out.void
setSecurityManager
(SecurityManager securityManager) Configures theSecurityManager
used to secure this cache.void
setUseClusterConfiguration
(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, resolveCache
Methods inherited from class org.springframework.data.gemfire.AbstractConfigurableCacheFactoryBean
afterPropertiesSet, destroy, getBeanFactoryLocator, getCacheXml, getOptionalBeanFactoryLocator, getOptionalCacheXml, getProperties, isCacheXmlPresent, isCacheXmlResolvableAsAFile, isUseBeanFactoryLocator, loadCacheXml, resolveProperties, setAndGetProperties, setBeanFactoryLocator, setCacheXml, setProperties, setUseBeanFactoryLocator
Methods 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, translateExceptionIfPossible
Methods 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 compositePeerCacheConfigurers
to thisCacheFactoryBean
before thepeer cache
is created.- Specified by:
applyCacheConfigurers
in classAbstractBasicCacheFactoryBean
- See Also:
-
applyPeerCacheConfigurers
Applies the array ofPeerCacheConfigurers
to thisCacheFactoryBean
before thepeer cache
is created.- Parameters:
peerCacheConfigurers
- array ofPeerCacheConfigurers
applied to thisCacheFactoryBean
.- See Also:
-
applyPeerCacheConfigurers
Applies theIterable
ofPeerCacheConfigurers
to thisCacheFactoryBean
before thepeer cache
is created.- Parameters:
peerCacheConfigurers
-Iterable
ofPeerCacheConfigurers
applied to thisCacheFactoryBean
.- See Also:
-
doFetchCache
Description copied from class:AbstractBasicCacheFactoryBean
Called byAbstractBasicCacheFactoryBean.fetchCache()
if theGemFireCache
reference returned byAbstractBasicCacheFactoryBean.getCache()
is null. This method is typically implemented by callingCacheFactory.getAnyInstance()
orClientCacheFactory.getAnyInstance()
depending on theGemFireCache
type declared and used in the Spring application.- Specified by:
doFetchCache
in classAbstractBasicCacheFactoryBean
- Type Parameters:
T
- parameterizedClass
type extendingGemFireCache
.- Returns:
- a (existing) reference to a
GemFireCache
instance. - See Also:
-
doGetObjectType
Description copied from class:AbstractBasicCacheFactoryBean
By default, returnsGemFireCache
Class
.- Overrides:
doGetObjectType
in classAbstractBasicCacheFactoryBean
- Returns:
GemFireCache
Class
by default.- See Also:
-
createFactory
Constructs a new instance ofCacheFactory
initialized with the given Apache GeodeProperties
used to construct, configure and initialize a new peerCache
instance.- Specified by:
createFactory
in classAbstractResolvableCacheFactoryBean
- Parameters:
gemfireProperties
-Properties
used by theCacheFactory
to configure the peerCache
.- Returns:
- a new instance of
CacheFactory
initialized with the given Apache GeodeProperties
. - See Also:
-
configureFactory
Configures theCacheFactory
used to create theCache
.- Overrides:
configureFactory
in classAbstractResolvableCacheFactoryBean
- Parameters:
factory
-CacheFactory
used to create theCache
.- Returns:
- the configured
CacheFactory
. - See Also:
-
configurePdx
Configures theCache
to use PDX serialization.- Parameters:
cacheFactory
-CacheFactory
to configure with PDX.- Returns:
- the given
CacheFactory
. - See Also:
-
configureSecurity
Configures theCache
with security.- Parameters:
cacheFactory
-CacheFactory
used to configure the peerCache
instance with security.- Returns:
- the given
CacheFactory
. - See Also:
-
createCache
- Specified by:
createCache
in classAbstractResolvableCacheFactoryBean
- Type Parameters:
T
-sub-type
ofGemFireCache
.- Parameters:
factory
- instance ofCacheFactory
.- Returns:
- a new instance of
Cache
created by the providedfactory
. - See Also:
-
postProcess
Post process theGemFireCache
by 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:
postProcess
in classAbstractResolvableCacheFactoryBean
- Type Parameters:
T
- parameterizedClass
type extendingGemFireCache
.- Parameters:
cache
-GemFireCache
to 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 CompositePeerCacheConfigurer
used to apply additional configuration to thisCacheFactoryBean
during 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 ofPeerCacheConfigurers
used to apply additional configuration to thisCacheFactoryBean
when using Annotation-based configuration.- Parameters:
peerCacheConfigurers
- array ofPeerCacheConfigurers
used to apply additional configuration to thisCacheFactoryBean
.- See Also:
-
setPeerCacheConfigurers
Null-safe operation to set anIterable
ofPeerCacheConfigurers
to apply additional configuration to thisCacheFactoryBean
when using Annotation-based configuration.- Parameters:
peerCacheConfigurers
-Iterable
ofPeerCacheConfigurers
used 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 theSecurityManager
used to secure this cache.- Parameters:
securityManager
-SecurityManager
used to secure this cache.- See Also:
-
getSecurityManager
Returns theSecurityManager
used to secure this cache.- Returns:
- the
SecurityManager
used 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.
-