public class CacheFactoryBean extends AbstractResolvableCacheFactoryBean
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
.Properties
,
Cache
,
CacheFactory
,
GemFireCache
,
PdxSerializer
,
SecurityManager
,
FactoryBean
,
AbstractResolvableCacheFactoryBean
,
PeerCacheConfigurer
Modifier and Type | Class and Description |
---|---|
static class |
CacheFactoryBean.CacheFactoryToPdxConfigurerAdapter |
static class |
CacheFactoryBean.JndiDataSource |
AbstractBasicCacheFactoryBean.CacheFactoryInitializer<T>, AbstractBasicCacheFactoryBean.PdxConfigurer<T>
DEFAULT_SINGLETON
OBJECT_TYPE_ATTRIBUTE
Constructor and Description |
---|
CacheFactoryBean() |
Modifier and Type | Method and Description |
---|---|
protected void |
applyCacheConfigurers()
Applies the composite
PeerCacheConfigurers to this CacheFactoryBean
before the peer cache is created. |
protected void |
applyPeerCacheConfigurers(Iterable<PeerCacheConfigurer> peerCacheConfigurers)
Applies the
Iterable of PeerCacheConfigurers to this CacheFactoryBean
before the peer cache is created. |
protected void |
applyPeerCacheConfigurers(PeerCacheConfigurer... peerCacheConfigurers)
Applies the array of
PeerCacheConfigurers to this CacheFactoryBean
before the peer cache is created. |
protected Object |
configureFactory(Object factory)
Configures the
CacheFactory used to create the Cache . |
protected org.apache.geode.cache.CacheFactory |
configurePdx(org.apache.geode.cache.CacheFactory cacheFactory)
Configures the
Cache to use PDX serialization. |
protected org.apache.geode.cache.CacheFactory |
configureSecurity(org.apache.geode.cache.CacheFactory cacheFactory)
Configures the
Cache with security. |
protected <T extends org.apache.geode.cache.GemFireCache> |
createCache(Object factory)
Creates a new
Cache instance using the provided factory . |
protected Object |
createFactory(Properties gemfireProperties)
Constructs a new instance of
CacheFactory initialized with the given Apache Geode Properties
used to construct, configure and initialize a new peer Cache instance. |
protected <T extends org.apache.geode.cache.GemFireCache> |
doFetchCache()
Called by
AbstractBasicCacheFactoryBean.fetchCache() if the GemFireCache reference returned by AbstractBasicCacheFactoryBean.getCache()
is null. |
protected Class<? extends org.apache.geode.cache.GemFireCache> |
doGetObjectType()
By default, returns
GemFireCache Class . |
PeerCacheConfigurer |
getCompositePeerCacheConfigurer()
Returns a reference to the Composite
PeerCacheConfigurer used to
apply additional configuration to this CacheFactoryBean during Spring container initialization. |
Boolean |
getEnableAutoReconnect()
Gets the value for the auto-reconnect setting.
|
org.apache.geode.cache.util.GatewayConflictResolver |
getGatewayConflictResolver() |
List<CacheFactoryBean.JndiDataSource> |
getJndiDataSources() |
Integer |
getLockLease() |
Integer |
getLockTimeout() |
Integer |
getMessageSyncInterval() |
Integer |
getSearchTimeout() |
org.apache.geode.security.SecurityManager |
getSecurityManager()
Returns the
SecurityManager used to secure this cache. |
Boolean |
getUseClusterConfiguration()
Return the state of the use-shared-configuration Pivotal GemFire/Apache Geode
distribution configuration setting.
|
protected <T extends org.apache.geode.cache.GemFireCache> |
postProcess(T cache)
Post process the
GemFireCache 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 higher
|
void |
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 an
Iterable of PeerCacheConfigurers to apply
additional configuration to this CacheFactoryBean when using Annotation-based configuration. |
void |
setPeerCacheConfigurers(PeerCacheConfigurer... peerCacheConfigurers)
Null-safe operation to set an array of
PeerCacheConfigurers used to apply
additional configuration to this CacheFactoryBean 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 the
SecurityManager used to secure this cache. |
void |
setUseClusterConfiguration(Boolean useSharedConfiguration)
Sets the state of the use-shared-configuration Pivotal GemFire/Apache Geode
distribution configuration setting.
|
doGetObject, init, initializeFactory, postProcess, resolveCache
afterPropertiesSet, destroy, getBeanFactoryLocator, getCacheXml, getOptionalBeanFactoryLocator, getOptionalCacheXml, getProperties, isCacheXmlPresent, isCacheXmlResolvableAsAFile, isUseBeanFactoryLocator, loadCacheXml, resolveProperties, setAndGetProperties, setBeanFactoryLocator, setCacheXml, setProperties, setUseBeanFactoryLocator
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
getBeanClassLoader, getBeanFactory, getBeanName, getLogger, getOptionalLogger, isDebugLoggingEnabled, isErrorLoggingEnabled, isInfoLoggingEnabled, isSingleton, isWarnLoggingEnabled, logDebug, logDebug, logError, logError, logInfo, logInfo, logWarning, logWarning, newLogger, setBeanClassLoader, setBeanFactory, setBeanName
protected void applyCacheConfigurers()
PeerCacheConfigurers
to this CacheFactoryBean
before the peer cache
is created.applyCacheConfigurers
in class AbstractBasicCacheFactoryBean
getCompositePeerCacheConfigurer()
,
applyPeerCacheConfigurers(PeerCacheConfigurer...)
protected void applyPeerCacheConfigurers(PeerCacheConfigurer... peerCacheConfigurers)
PeerCacheConfigurers
to this CacheFactoryBean
before the peer cache
is created.peerCacheConfigurers
- array of PeerCacheConfigurers
applied to this CacheFactoryBean
.PeerCacheConfigurer
,
applyPeerCacheConfigurers(Iterable)
protected void applyPeerCacheConfigurers(Iterable<PeerCacheConfigurer> peerCacheConfigurers)
Iterable
of PeerCacheConfigurers
to this CacheFactoryBean
before the peer cache
is created.peerCacheConfigurers
- Iterable
of PeerCacheConfigurers
applied to this CacheFactoryBean
.PeerCacheConfigurer
,
Iterable
protected <T extends org.apache.geode.cache.GemFireCache> T doFetchCache()
AbstractBasicCacheFactoryBean
AbstractBasicCacheFactoryBean.fetchCache()
if the GemFireCache
reference returned by AbstractBasicCacheFactoryBean.getCache()
is null.
This method is typically implemented by calling CacheFactory.getAnyInstance()
or ClientCacheFactory.getAnyInstance()
depending on the GemFireCache
type declared
and used in the Spring application.doFetchCache
in class AbstractBasicCacheFactoryBean
T
- parameterized Class
type extending GemFireCache
.GemFireCache
instance.AbstractBasicCacheFactoryBean.fetchCache()
protected Class<? extends org.apache.geode.cache.GemFireCache> doGetObjectType()
AbstractBasicCacheFactoryBean
GemFireCache
Class
.doGetObjectType
in class AbstractBasicCacheFactoryBean
GemFireCache
Class
by default.GemFireCache
,
AbstractBasicCacheFactoryBean.getObjectType()
,
Class
@NonNull protected Object createFactory(@NonNull Properties gemfireProperties)
CacheFactory
initialized with the given Apache Geode Properties
used to construct, configure and initialize a new peer Cache
instance.createFactory
in class AbstractResolvableCacheFactoryBean
gemfireProperties
- Properties
used by the CacheFactory
to configure the peer Cache
.CacheFactory
initialized with the given Apache Geode Properties
.CacheFactory
,
Properties
@NonNull protected Object configureFactory(@NonNull Object factory)
CacheFactory
used to create the Cache
.configureFactory
in class AbstractResolvableCacheFactoryBean
factory
- CacheFactory
used to create the Cache
.CacheFactory
.configurePdx(CacheFactory)
,
configureSecurity(CacheFactory)
,
CacheFactory
@NonNull protected org.apache.geode.cache.CacheFactory configurePdx(@NonNull org.apache.geode.cache.CacheFactory cacheFactory)
Cache
to use PDX serialization.cacheFactory
- CacheFactory
to configure with PDX.CacheFactory
.CacheFactoryBean.CacheFactoryToPdxConfigurerAdapter
,
CacheFactory
,
AbstractBasicCacheFactoryBean.configurePdx(PdxConfigurer)
@NonNull protected org.apache.geode.cache.CacheFactory configureSecurity(@NonNull org.apache.geode.cache.CacheFactory cacheFactory)
Cache
with security.cacheFactory
- CacheFactory
used to configure the peer Cache
instance with security.CacheFactory
.CacheFactory
@NonNull protected <T extends org.apache.geode.cache.GemFireCache> T createCache(@NonNull Object factory)
Cache
instance using the provided factory
.createCache
in class AbstractResolvableCacheFactoryBean
T
- sub-type
of GemFireCache
.factory
- instance of CacheFactory
.Cache
created by the provided factory
.CacheFactory.create()
,
GemFireCache
@NonNull protected <T extends org.apache.geode.cache.GemFireCache> T postProcess(@NonNull T cache)
GemFireCache
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.postProcess
in class AbstractResolvableCacheFactoryBean
T
- parameterized Class
type extending GemFireCache
.cache
- GemFireCache
to post process.GemFireCache
.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)
@NonNull public PeerCacheConfigurer getCompositePeerCacheConfigurer()
PeerCacheConfigurer
used to
apply additional configuration to this CacheFactoryBean
during Spring container initialization.PeerCacheConfigurer
.PeerCacheConfigurer
public void setEnableAutoReconnect(@Nullable Boolean enableAutoReconnect)
enableAutoReconnect
- a boolean value to enable/disable auto-reconnect functionality.@Nullable public Boolean getEnableAutoReconnect()
public void setGatewayConflictResolver(@Nullable org.apache.geode.cache.util.GatewayConflictResolver gatewayConflictResolver)
gatewayConflictResolver
- defined as Object in the signature for backward
compatibility with Gemfire 6 compatibility. This must be an instance of
GatewayConflictResolver
@Nullable public org.apache.geode.cache.util.GatewayConflictResolver getGatewayConflictResolver()
public void setJndiDataSources(List<CacheFactoryBean.JndiDataSource> jndiDataSources)
jndiDataSources
- the list of configured JndiDataSources to use with this Cache.public List<CacheFactoryBean.JndiDataSource> getJndiDataSources()
public void setLockLease(@Nullable Integer lockLease)
lockLease
- an integer value indicating the object lock lease timeout.public void setLockTimeout(@Nullable Integer lockTimeout)
lockTimeout
- an integer value specifying the object lock request timeout.public void setMessageSyncInterval(@Nullable Integer messageSyncInterval)
messageSyncInterval
- an integer value specifying the number of seconds in which the primary server
sends messages to secondary servers.@Nullable public Integer getMessageSyncInterval()
public void setPeerCacheConfigurers(PeerCacheConfigurer... peerCacheConfigurers)
PeerCacheConfigurers
used to apply
additional configuration to this CacheFactoryBean
when using Annotation-based configuration.peerCacheConfigurers
- array of PeerCacheConfigurers
used to apply
additional configuration to this CacheFactoryBean
.PeerCacheConfigurer
,
setPeerCacheConfigurers(List)
public void setPeerCacheConfigurers(List<PeerCacheConfigurer> peerCacheConfigurers)
Iterable
of PeerCacheConfigurers
to apply
additional configuration to this CacheFactoryBean
when using Annotation-based configuration.peerCacheConfigurers
- Iterable
of PeerCacheConfigurers
used to apply
additional configuration to this CacheFactoryBean
.PeerCacheConfigurer
public void setSearchTimeout(@Nullable Integer searchTimeout)
searchTimeout
- an integer value indicating the netSearch timeout value.public void setSecurityManager(@Nullable org.apache.geode.security.SecurityManager securityManager)
SecurityManager
used to secure this cache.securityManager
- SecurityManager
used to secure this cache.SecurityManager
@Nullable public org.apache.geode.security.SecurityManager getSecurityManager()
SecurityManager
used to secure this cache.SecurityManager
used to secure this cache.SecurityManager
public void setUseClusterConfiguration(@Nullable Boolean useSharedConfiguration)
useSharedConfiguration
- boolean value to set the use-shared-configuration
Pivotal GemFire/Apache Geode distribution configuration setting.@Nullable public Boolean getUseClusterConfiguration()
Copyright © 2011–2023 Pivotal Software, Inc.. All rights reserved.