Package org.springframework.data.gemfire
Class CacheFactoryBean
java.lang.Object
org.springframework.data.gemfire.support.AbstractFactoryBeanSupport<org.apache.geode.cache.GemFireCache>
org.springframework.data.gemfire.AbstractBasicCacheFactoryBean
org.springframework.data.gemfire.AbstractConfigurableCacheFactoryBean
org.springframework.data.gemfire.AbstractResolvableCacheFactoryBean
org.springframework.data.gemfire.CacheFactoryBean
- All Implemented Interfaces:
org.springframework.beans.factory.Aware
,org.springframework.beans.factory.BeanClassLoaderAware
,org.springframework.beans.factory.BeanFactoryAware
,org.springframework.beans.factory.BeanNameAware
,org.springframework.beans.factory.DisposableBean
,org.springframework.beans.factory.FactoryBean<org.apache.geode.cache.GemFireCache>
,org.springframework.beans.factory.InitializingBean
,org.springframework.context.Phased
,org.springframework.dao.support.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
.- See Also:
-
Properties
Cache
CacheFactory
GemFireCache
PdxSerializer
SecurityManager
FactoryBean
AbstractResolvableCacheFactoryBean
PeerCacheConfigurer
-
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 org.apache.geode.cache.CacheFactory
configurePdx
(org.apache.geode.cache.CacheFactory cacheFactory) Configures theCache
to use PDX serialization.protected org.apache.geode.cache.CacheFactory
configureSecurity
(org.apache.geode.cache.CacheFactory cacheFactory) Configures theCache
with security.protected <T extends org.apache.geode.cache.GemFireCache>
TcreateCache
(Object factory) Creates a newCache
instance using the providedfactory
.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 org.apache.geode.cache.GemFireCache>
TCalled byAbstractBasicCacheFactoryBean.fetchCache()
if theGemFireCache
reference returned byAbstractBasicCacheFactoryBean.getCache()
is null.protected Class<? extends org.apache.geode.cache.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.org.apache.geode.cache.util.GatewayConflictResolver
org.apache.geode.security.SecurityManager
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 org.apache.geode.cache.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
(org.apache.geode.cache.util.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
(org.apache.geode.security.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, getLogger, getOptionalLogger, isDebugLoggingEnabled, isErrorLoggingEnabled, isInfoLoggingEnabled, isSingleton, isWarnLoggingEnabled, logDebug, logDebug, logError, logError, logInfo, logInfo, logWarning, logWarning, newLogger, 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
protected <T extends org.apache.geode.cache.GemFireCache> T 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:
-
GemFireCache
AbstractBasicCacheFactoryBean.getObjectType()
Class
-
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:
-
CacheFactory
Properties
-
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
@NonNull protected org.apache.geode.cache.CacheFactory configurePdx(@NonNull org.apache.geode.cache.CacheFactory cacheFactory) Configures theCache
to use PDX serialization.- Parameters:
cacheFactory
-CacheFactory
to configure with PDX.- Returns:
- the given
CacheFactory
. - See Also:
-
configureSecurity
@NonNull protected org.apache.geode.cache.CacheFactory configureSecurity(@NonNull org.apache.geode.cache.CacheFactory cacheFactory) Configures theCache
with security.- Parameters:
cacheFactory
-CacheFactory
used to configure the peerCache
instance with security.- Returns:
- the given
CacheFactory
. - See Also:
-
CacheFactory
-
createCache
@NonNull protected <T extends org.apache.geode.cache.GemFireCache> T createCache(@NonNull Object factory) Creates a newCache
instance using the providedfactory
.- 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:
-
CacheFactory.create()
GemFireCache
-
postProcess
@NonNull protected <T extends org.apache.geode.cache.GemFireCache> T postProcess(@NonNull 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.- 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(GemFireCache)
AbstractBasicCacheFactoryBean.configureOffHeapPercentages(GemFireCache)
registerJndiDataSources(GemFireCache)
AbstractBasicCacheFactoryBean.registerTransactionListeners(GemFireCache)
AbstractBasicCacheFactoryBean.registerTransactionWriter(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
public void setGatewayConflictResolver(@Nullable org.apache.geode.cache.util.GatewayConflictResolver gatewayConflictResolver) 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
@Nullable public org.apache.geode.cache.util.GatewayConflictResolver 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
public void setSecurityManager(@Nullable org.apache.geode.security.SecurityManager securityManager) Configures theSecurityManager
used to secure this cache.- Parameters:
securityManager
-SecurityManager
used to secure this cache.- See Also:
-
SecurityManager
-
getSecurityManager
@Nullable public org.apache.geode.security.SecurityManager getSecurityManager()Returns theSecurityManager
used to secure this cache.- Returns:
- the
SecurityManager
used to secure this cache. - See Also:
-
SecurityManager
-
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.
-