Spring Data for VMware GemFire
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:
-
PropertiesCacheCacheFactoryGemFireCachePdxSerializerSecurityManagerFactoryBeanAbstractResolvableCacheFactoryBeanPeerCacheConfigurer
-
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 org.apache.geode.cache.CacheFactoryconfigurePdx(org.apache.geode.cache.CacheFactory cacheFactory) Configures theCacheto use PDX serialization.protected org.apache.geode.cache.CacheFactoryconfigureSecurity(org.apache.geode.cache.CacheFactory cacheFactory) Configures theCachewith security.protected <T extends org.apache.geode.cache.GemFireCache>
TcreateCache(Object factory) Creates a newCacheinstance using the providedfactory.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 org.apache.geode.cache.GemFireCache>
TCalled byAbstractBasicCacheFactoryBean.fetchCache()if theGemFireCachereference returned byAbstractBasicCacheFactoryBean.getCache()is null.protected Class<? extends org.apache.geode.cache.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.org.apache.geode.cache.util.GatewayConflictResolverorg.apache.geode.security.SecurityManagerReturns theSecurityManagerused to secure this cache.Return the state of the use-shared-configuration Pivotal GemFire/Apache Geode distribution configuration setting.Return the state of the use-udp-membership-messengerproperty.protected <T extends org.apache.geode.cache.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(org.apache.geode.cache.util.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(org.apache.geode.security.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.voidsetUseUDPMembershipMessenger(Boolean useUDPMembershipMessenger) Sets the state of the use-udp-membership-messenger VMware GemFire property.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, 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 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
protected <T extends org.apache.geode.cache.GemFireCache> T 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:
-
GemFireCacheAbstractBasicCacheFactoryBean.getObjectType()Class
-
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:
-
CacheFactoryProperties
-
configureFactory
Configures theCacheFactoryused to create theCache.- Overrides:
configureFactoryin classAbstractResolvableCacheFactoryBean- Parameters:
factory-CacheFactoryused 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 theCacheto use PDX serialization.- Parameters:
cacheFactory-CacheFactoryto 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 theCachewith security.- Parameters:
cacheFactory-CacheFactoryused to configure the peerCacheinstance 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 newCacheinstance using the providedfactory.- Specified by:
createCachein classAbstractResolvableCacheFactoryBean- Type Parameters:
T-sub-typeofGemFireCache.- Parameters:
factory- instance ofCacheFactory.- Returns:
- a new instance of
Cachecreated 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 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(GemFireCache)AbstractBasicCacheFactoryBean.configureOffHeapPercentages(GemFireCache)registerJndiDataSources(GemFireCache)AbstractBasicCacheFactoryBean.registerTransactionListeners(GemFireCache)AbstractBasicCacheFactoryBean.registerTransactionWriter(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
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 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
public void setSecurityManager(@Nullable org.apache.geode.security.SecurityManager securityManager) Configures theSecurityManagerused to secure this cache.- Parameters:
securityManager-SecurityManagerused to secure this cache.- See Also:
-
SecurityManager
-
getSecurityManager
@Nullable public org.apache.geode.security.SecurityManager getSecurityManager()Returns theSecurityManagerused to secure this cache.- Returns:
- the
SecurityManagerused 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.
-
setUseUDPMembershipMessenger
Sets the state of the use-udp-membership-messenger VMware GemFire property.- Parameters:
useUDPMembershipMessenger- boolean value to set the use-udp-membership-messenger property.
-
getUseUDPMembershipMessenger
Return the state of the use-udp-membership-messengerproperty.- Returns:
- the current boolean value for the use-udp-membership-messenger property..
-