Class ClientCacheFactoryBean
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
org.springframework.data.gemfire.client.ClientCacheFactoryBean
- All Implemented Interfaces:
EventListener,Aware,BeanClassLoaderAware,BeanFactoryAware,BeanNameAware,DisposableBean,FactoryBean<GemFireCache>,InitializingBean,ApplicationListener<ContextRefreshedEvent>,Phased,PersistenceExceptionTranslator
public class ClientCacheFactoryBean
extends CacheFactoryBean
implements ApplicationListener<ContextRefreshedEvent>
Spring
FactoryBean used to construct, configure and initialize a ClientCache.- Since:
- 1.0.0
- Author:
- Costin Leau, Lyndon Adams, John Blum
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classNested classes/interfaces inherited from class org.springframework.data.gemfire.CacheFactoryBean
CacheFactoryBean.CacheFactoryToPdxConfigurerAdapter, CacheFactoryBean.JndiDataSourceNested classes/interfaces inherited from class org.springframework.data.gemfire.AbstractBasicCacheFactoryBean
AbstractBasicCacheFactoryBean.CacheFactoryInitializer<T>, AbstractBasicCacheFactoryBean.PdxConfigurer<T> -
Field Summary
FieldsFields 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 TypeMethodDescriptionvoidaddLocators(Iterable<ConnectionEndpoint> locators) voidaddLocators(ConnectionEndpoint... locators) voidaddServers(Iterable<ConnectionEndpoint> servers) voidaddServers(ConnectionEndpoint... servers) protected voidApplies the compositeClientCacheConfigurersto thisClientCacheFactoryBeanbefore theClientCacheis created.protected voidapplyClientCacheConfigurers(Iterable<ClientCacheConfigurer> clientCacheConfigurers) Apples theIterableofClientCacheConfigurersto thisClientCacheFactoryBeanbefore theClientCacheis created.protected voidapplyClientCacheConfigurers(ClientCacheConfigurer... clientCacheConfigurers) Applies the array ofClientCacheConfigurersto thisClientCacheFactoryBeanbefore theClientCacheis created.protected voidclose(GemFireCache cache) Null-safe internal method used to close theClientCacheand preserve durability.protected ObjectconfigureFactory(Object factory) Configures theClientCacheFactoryused to create theClientCache.protected ClientCacheFactoryconfigurePdx(ClientCacheFactory clientCacheFactory) Configures theClientCacheto use PDX serialization.protected ClientCacheFactoryconfigurePool(ClientCacheFactory clientCacheFactory) Configure the DEFAULTPoolof theClientCacheFactoryusing a givenPoolinstance or a namedPoolinstance.protected <T extends GemFireCache>
TcreateCache(Object factory) Creates a newClientCacheinstance using the providedfactory.protected ObjectcreateFactory(Properties gemfireProperties) Constructs a new instance ofClientCacheFactoryinitialized with the given Apache GeodePropertiesused to construct, configure and initialize a newClientCacheinstance.protected <T extends GemFireCache>
TFetches an existingClientCacheinstance from theClientCacheFactory.protected Class<? extends GemFireCache>Returns a reference to the CompositeClientCacheConfigurerused to apply additional configuration to thisClientCacheFactoryBeanon Spring container initialization.Gets the value of the GemFire System property 'durable-client-id' indicating to the server whether this client is durable.Get the value of the GemFire System property 'durable-client-timeout' indicating to the server how long to track events for the durable client when disconnected.final BooleanGets the value for the auto-reconnect setting.Gets the user specified value for whether the server(s) should keep the durable client's queue alive for the duration of the timeout when the client voluntarily disconnects.protected ConnectionEndpointListgetPool()Gets thePoolused by thisClientCacheto obtain connections to the Apache Geode cluster.Gets thenameof thePoolused by thisClientCacheto obtain connections to the Apache Geode cluster.Gets the user-configured value for deciding that this client is ready to receive events from the server(s).protected ConnectionEndpointListfinal BooleanReturn the state of the use-shared-configuration Pivotal GemFire/Apache Geode distribution configuration setting.booleanDetermines whether the server(s) should keep the durable client's queue alive for the duration of the timeout when the client voluntarily disconnects.booleanDetermines whether this GemFire cache client is ready for events.voidInform the Apache Geode cluster that thisClientCacheis ready to receive events iff the client is non-durable.protected Poolprotected PropertiesResolves the Apache GeodePropertiesused to configure theClientCache.voidsetClientCacheConfigurers(List<ClientCacheConfigurer> clientCacheConfigurers) Null-safe operation to set anListofClientCacheConfigurersto apply additional configuration to thisClientCacheFactoryBeanwhen using Annotation-based configuration.voidsetClientCacheConfigurers(ClientCacheConfigurer... clientCacheConfigurers) Null-safe operation to set an array ofClientCacheConfigurersused to apply additional configuration to thisClientCacheFactoryBeanwhen using Annotation-based configuration.voidsetDurableClientId(String durableClientId) Set the GemFire System property 'durable-client-id' to indicate to the server that this client is durable.voidsetDurableClientTimeout(Integer durableClientTimeout) Set the GemFire System property 'durable-client-timeout' indicating to the server how long to track events for the durable client when disconnected.final voidsetEnableAutoReconnect(Boolean enableAutoReconnect) Controls whether auto-reconnect functionality introduced in GemFire 8 is enabled or not.voidsetFreeConnectionTimeout(Integer freeConnectionTimeout) voidsetIdleTimeout(Long idleTimeout) voidsetKeepAlive(Boolean keepAlive) Sets whether the server(s) should keep the durable client's queue alive for the duration of the timeout when the client voluntarily disconnects.voidsetLoadConditioningInterval(Integer loadConditioningInterval) voidsetLocators(Iterable<ConnectionEndpoint> locators) voidsetLocators(ConnectionEndpoint[] locators) voidsetMaxConnections(Integer maxConnections) voidsetMinConnections(Integer minConnections) voidsetMultiUserAuthentication(Boolean multiUserAuthentication) voidsetPingInterval(Long pingInterval) voidSets thePoolused by thisClientCacheto obtain connections to the Apache Geode cluster.voidsetPoolName(String poolName) Sets thenameof thePoolused by thisClientCacheto obtain connections to the Apache Geode cluster.voidsetPoolResolver(PoolResolver poolResolver) voidsetPrSingleHopEnabled(Boolean prSingleHopEnabled) voidsetReadTimeout(Integer readTimeout) voidsetReadyForEvents(Boolean readyForEvents) Sets the readyForEvents property to indicate whether the cache client should notify the server that it is ready to receive updates.voidsetRetryAttempts(Integer retryAttempts) voidsetServerConnectionTimeout(Integer serverConnectionTimeout) voidsetServerGroup(String serverGroup) voidsetServers(Iterable<ConnectionEndpoint> servers) voidsetServers(ConnectionEndpoint[] servers) voidsetSocketBufferSize(Integer socketBufferSize) voidsetSocketConnectTimeout(Integer socketConnectTimeout) voidsetSocketFactory(SocketFactory socketFactory) voidsetStatisticsInterval(Integer statisticsInterval) voidsetSubscriptionAckInterval(Integer subscriptionAckInterval) voidsetSubscriptionEnabled(Boolean subscriptionEnabled) voidsetSubscriptionMessageTrackingTimeout(Integer subscriptionMessageTrackingTimeout) voidsetSubscriptionRedundancy(Integer subscriptionRedundancy) voidsetThreadLocalConnections(Boolean threadLocalConnections) final voidsetUseClusterConfiguration(Boolean useClusterConfiguration) Sets the state of the use-shared-configuration Pivotal GemFire/Apache Geode distribution configuration setting.Methods inherited from class org.springframework.data.gemfire.CacheFactoryBean
applyPeerCacheConfigurers, applyPeerCacheConfigurers, configurePdx, configureSecurity, getCompositePeerCacheConfigurer, getGatewayConflictResolver, getJndiDataSources, getLockLease, getLockTimeout, getMessageSyncInterval, getSearchTimeout, getSecurityManager, postProcess, setGatewayConflictResolver, setJndiDataSources, setLockLease, setLockTimeout, setMessageSyncInterval, setPeerCacheConfigurers, setPeerCacheConfigurers, setSearchTimeout, setSecurityManagerMethods 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, setAndGetProperties, setBeanFactoryLocator, setCacheXml, setProperties, setUseBeanFactoryLocatorMethods inherited from class org.springframework.data.gemfire.AbstractBasicCacheFactoryBean
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
-
Field Details
-
DEFAULT_POOL_RESOLVER
-
-
Constructor Details
-
ClientCacheFactoryBean
public ClientCacheFactoryBean()
-
-
Method Details
-
applyCacheConfigurers
protected void applyCacheConfigurers()Applies the compositeClientCacheConfigurersto thisClientCacheFactoryBeanbefore theClientCacheis created.- Overrides:
applyCacheConfigurersin classCacheFactoryBean- See Also:
-
applyClientCacheConfigurers
Applies the array ofClientCacheConfigurersto thisClientCacheFactoryBeanbefore theClientCacheis created.- Parameters:
clientCacheConfigurers- array ofClientCacheConfigurersapplied to thisClientCacheFactoryBean.- See Also:
-
applyClientCacheConfigurers
Apples theIterableofClientCacheConfigurersto thisClientCacheFactoryBeanbefore theClientCacheis created.- Parameters:
clientCacheConfigurers-IterableofClientCacheConfigurersapplied to thisClientCacheFactoryBean.- See Also:
-
doFetchCache
Fetches an existingClientCacheinstance from theClientCacheFactory.- Overrides:
doFetchCachein classCacheFactoryBean- Type Parameters:
T- parameterizedClasstype extension ofGemFireCache.- Returns:
- an existing
ClientCacheinstance if available. - Throws:
CacheClosedException- if an existingClientCacheinstance does not exist.- See Also:
-
doGetObjectType
Returns thetypeofGemFireCacheconstructed by thisClientCacheFactoryBean. ReturnsClientCacheClass.- Overrides:
doGetObjectTypein classCacheFactoryBean- Returns:
- the
typeofGemFireCacheconstructed by thisClientCacheFactoryBean. - See Also:
-
resolveProperties
Resolves the Apache GeodePropertiesused to configure theClientCache.- Overrides:
resolvePropertiesin classAbstractConfigurableCacheFactoryBean- Returns:
- the resolved Apache Geode
Propertiesused to configure theClientCache. - See Also:
-
createFactory
Constructs a new instance ofClientCacheFactoryinitialized with the given Apache GeodePropertiesused to construct, configure and initialize a newClientCacheinstance.- Overrides:
createFactoryin classCacheFactoryBean- Parameters:
gemfireProperties-Propertiesused by theClientCacheFactoryto configure theClientCache.- Returns:
- a new instance of
ClientCacheFactoryinitialized with the given Apache GeodeProperties. - See Also:
-
configureFactory
Configures theClientCacheFactoryused to create theClientCache.- Overrides:
configureFactoryin classCacheFactoryBean- Parameters:
factory-ClientCacheFactoryused to create theClientCache.- Returns:
- the configured
ClientCacheFactory. - See Also:
-
configurePdx
Configures theClientCacheto use PDX serialization.- Parameters:
clientCacheFactory-ClientCacheFactoryto configure with PDX.- Returns:
- the given
ClientCacheFactory. - See Also:
-
configurePool
Configure the DEFAULTPoolof theClientCacheFactoryusing a givenPoolinstance or a namedPoolinstance.- Parameters:
clientCacheFactory-ClientCacheFactoryused to configure the DEFAULTPool.- See Also:
-
resolvePool
- Returns:
- the resolved
Poolused to configure theClientCache, DEFAULTPool. - See Also:
-
PoolManager.find(String)PoolgetPoolName()getPool()findPool(String)isPoolNameResolvable(String)
-
createCache
Creates a newClientCacheinstance using the providedfactory.- Overrides:
createCachein classCacheFactoryBean- Type Parameters:
T- parameterizedClasstype extendingGemFireCache.- Parameters:
factory- instance ofClientCacheFactory.- Returns:
- a new instance of
ClientCachecreated by the provided factory. - See Also:
-
onApplicationEvent
Inform the Apache Geode cluster that thisClientCacheis ready to receive events iff the client is non-durable.- Specified by:
onApplicationEventin interfaceApplicationListener<ContextRefreshedEvent>- Parameters:
event-ApplicationContextEventfired when theApplicationContextis refreshed.- See Also:
-
close
Null-safe internal method used to close theClientCacheand preserve durability.- Overrides:
closein classAbstractBasicCacheFactoryBean- Parameters:
cache-GemFireCacheto close.- See Also:
-
addLocators
-
addLocators
-
addServers
-
addServers
-
setClientCacheConfigurers
Null-safe operation to set an array ofClientCacheConfigurersused to apply additional configuration to thisClientCacheFactoryBeanwhen using Annotation-based configuration.- Parameters:
clientCacheConfigurers- array ofClientCacheConfigurersused to apply additional configuration to thisClientCacheFactoryBean.- See Also:
-
setClientCacheConfigurers
Null-safe operation to set anListofClientCacheConfigurersto apply additional configuration to thisClientCacheFactoryBeanwhen using Annotation-based configuration.- Parameters:
clientCacheConfigurers-ListofClientCacheConfigurersused to apply additional configuration to thisClientCacheFactoryBean.- See Also:
-
getCompositeClientCacheConfigurer
Returns a reference to the CompositeClientCacheConfigurerused to apply additional configuration to thisClientCacheFactoryBeanon Spring container initialization.- Returns:
- the Composite
ClientCacheConfigurer. - See Also:
-
setDurableClientId
Set the GemFire System property 'durable-client-id' to indicate to the server that this client is durable.- Parameters:
durableClientId- a String value indicating the durable client id.
-
getDurableClientId
Gets the value of the GemFire System property 'durable-client-id' indicating to the server whether this client is durable.- Returns:
- a String value indicating the durable client id.
-
setDurableClientTimeout
Set the GemFire System property 'durable-client-timeout' indicating to the server how long to track events for the durable client when disconnected.- Parameters:
durableClientTimeout- an Integer value indicating the timeout in seconds for the server to keep the durable client's queue around.
-
getDurableClientTimeout
Get the value of the GemFire System property 'durable-client-timeout' indicating to the server how long to track events for the durable client when disconnected.- Returns:
- an Integer value indicating the timeout in seconds for the server to keep the durable client's queue around.
-
setEnableAutoReconnect
Description copied from class:CacheFactoryBeanControls whether auto-reconnect functionality introduced in GemFire 8 is enabled or not.- Overrides:
setEnableAutoReconnectin classCacheFactoryBean- Parameters:
enableAutoReconnect- a boolean value to enable/disable auto-reconnect functionality.
-
getEnableAutoReconnect
Description copied from class:CacheFactoryBeanGets the value for the auto-reconnect setting.- Overrides:
getEnableAutoReconnectin classCacheFactoryBean- Returns:
- a boolean value indicating whether auto-reconnect was specified (non-null) and whether it was enabled or not.
-
setFreeConnectionTimeout
-
getFreeConnectionTimeout
-
setIdleTimeout
-
getIdleTimeout
-
setKeepAlive
Sets whether the server(s) should keep the durable client's queue alive for the duration of the timeout when the client voluntarily disconnects.- Parameters:
keepAlive- a boolean value indicating to the server to keep the durable client's queues alive.
-
getKeepAlive
Gets the user specified value for whether the server(s) should keep the durable client's queue alive for the duration of the timeout when the client voluntarily disconnects.- Returns:
- a boolean value indicating whether the server should keep the durable client's queues alive.
-
isKeepAlive
public boolean isKeepAlive()Determines whether the server(s) should keep the durable client's queue alive for the duration of the timeout when the client voluntarily disconnects.- Returns:
- a boolean value indicating whether the server should keep the durable client's queues alive.
-
setLoadConditioningInterval
-
getLoadConditioningInterval
-
setLocators
-
setLocators
-
getLocators
-
setMaxConnections
-
getMaxConnections
-
setMinConnections
-
getMinConnections
-
setMultiUserAuthentication
-
getMultiUserAuthentication
-
setPool
Sets thePoolused by thisClientCacheto obtain connections to the Apache Geode cluster.- Parameters:
pool-Poolused by thisClientCacheto obtain connections to the Apache Geode cluster.- See Also:
-
getPool
Gets thePoolused by thisClientCacheto obtain connections to the Apache Geode cluster.- Returns:
Poolused by thisClientCacheto obtain connections to the Apache Geode cluster.- See Also:
-
setPoolName
Sets thenameof thePoolused by thisClientCacheto obtain connections to the Apache Geode cluster.- Parameters:
poolName-nameof thePoolused by thisClientCacheto obtain connections to the Apache Geode cluster.
-
getPoolName
Gets thenameof thePoolused by thisClientCacheto obtain connections to the Apache Geode cluster.- Returns:
nameof thePoolused by thisClientCacheto obtain connections to the Apache Geode cluster.
-
setPoolResolver
Sets (configures) thePoolResolverused by thisClientCacheto resolvePoolobjects. ThePoolobjects may be managed or un-managed depending on thePoolResolverimplementation.- Parameters:
poolResolver-PoolResolverused to resolve the configuredPool.- See Also:
-
getPoolResolver
- Returns:
- the configured
PoolResolver. If noPoolResolverwas configured, then return the default,PoolManagerPoolResolver. - See Also:
-
setPingInterval
-
getPingInterval
-
setPrSingleHopEnabled
-
getPrSingleHopEnabled
-
setReadTimeout
-
getReadTimeout
-
setReadyForEvents
Sets the readyForEvents property to indicate whether the cache client should notify the server that it is ready to receive updates.- Parameters:
readyForEvents- sets a boolean flag to notify the server that this durable client is ready to receive updates.- See Also:
-
getReadyForEvents
Gets the user-configured value for deciding that this client is ready to receive events from the server(s).- Returns:
- a
Booleanindicating whether this client is ready to receive events from the server(s).
-
isReadyForEvents
public boolean isReadyForEvents()Determines whether this GemFire cache client is ready for events. If 'readyForEvents' was explicitly set, then it takes precedence over all other considerations (e.g. durability).- Returns:
- a boolean value indicating whether this GemFire cache client is ready for events.
- See Also:
-
setRetryAttempts
-
getRetryAttempts
-
setServerConnectionTimeout
-
getServerConnectionTimeout
-
setServerGroup
-
getServerGroup
-
setServers
-
setServers
-
getServers
-
setSocketBufferSize
-
getSocketBufferSize
-
setSocketConnectTimeout
-
getSocketConnectTimeout
-
setSocketFactory
-
getSocketFactory
-
setStatisticsInterval
-
getStatisticsInterval
-
setSubscriptionAckInterval
-
getSubscriptionAckInterval
-
setSubscriptionEnabled
-
getSubscriptionEnabled
-
setSubscriptionMessageTrackingTimeout
-
getSubscriptionMessageTrackingTimeout
-
setSubscriptionRedundancy
-
getSubscriptionRedundancy
-
setThreadLocalConnections
-
getThreadLocalConnections
-
setUseClusterConfiguration
Description copied from class:CacheFactoryBeanSets the state of the use-shared-configuration Pivotal GemFire/Apache Geode distribution configuration setting.- Overrides:
setUseClusterConfigurationin classCacheFactoryBean- Parameters:
useClusterConfiguration- boolean value to set the use-shared-configuration Pivotal GemFire/Apache Geode distribution configuration setting.
-
getUseClusterConfiguration
Description copied from class:CacheFactoryBeanReturn the state of the use-shared-configuration Pivotal GemFire/Apache Geode distribution configuration setting.- Overrides:
getUseClusterConfigurationin classCacheFactoryBean- Returns:
- the current boolean value for the use-shared-configuration Pivotal GemFire/Apache Geode distribution configuration setting.
-