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
Modifier and TypeClassDescriptionstatic class
Nested classes/interfaces inherited from class org.springframework.data.gemfire.CacheFactoryBean
CacheFactoryBean.CacheFactoryToPdxConfigurerAdapter, CacheFactoryBean.JndiDataSource
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 TypeMethodDescriptionvoid
addLocators
(Iterable<ConnectionEndpoint> locators) void
addLocators
(ConnectionEndpoint... locators) void
addServers
(Iterable<ConnectionEndpoint> servers) void
addServers
(ConnectionEndpoint... servers) protected void
Applies the compositeClientCacheConfigurers
to thisClientCacheFactoryBean
before theClientCache
is created.protected void
applyClientCacheConfigurers
(Iterable<ClientCacheConfigurer> clientCacheConfigurers) Apples theIterable
ofClientCacheConfigurers
to thisClientCacheFactoryBean
before theClientCache
is created.protected void
applyClientCacheConfigurers
(ClientCacheConfigurer... clientCacheConfigurers) Applies the array ofClientCacheConfigurers
to thisClientCacheFactoryBean
before theClientCache
is created.protected void
close
(GemFireCache cache) Null-safe internal method used to close theClientCache
and preserve durability.protected Object
configureFactory
(Object factory) Configures theClientCacheFactory
used to create theClientCache
.protected ClientCacheFactory
configurePdx
(ClientCacheFactory clientCacheFactory) Configures theClientCache
to use PDX serialization.protected ClientCacheFactory
configurePool
(ClientCacheFactory clientCacheFactory) Configure the DEFAULTPool
of theClientCacheFactory
using a givenPool
instance or a namedPool
instance.protected <T extends GemFireCache>
TcreateCache
(Object factory) Creates a newClientCache
instance using the providedfactory
.protected Object
createFactory
(Properties gemfireProperties) Constructs a new instance ofClientCacheFactory
initialized with the given Apache GeodeProperties
used to construct, configure and initialize a newClientCache
instance.protected <T extends GemFireCache>
TFetches an existingClientCache
instance from theClientCacheFactory
.protected Class<? extends GemFireCache>
Returns a reference to the CompositeClientCacheConfigurer
used to apply additional configuration to thisClientCacheFactoryBean
on 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 Boolean
Gets 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 ConnectionEndpointList
getPool()
Gets thePool
used by thisClientCache
to obtain connections to the Apache Geode cluster.Gets thename
of thePool
used by thisClientCache
to 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 ConnectionEndpointList
final Boolean
Return the state of the use-shared-configuration Pivotal GemFire/Apache Geode distribution configuration setting.boolean
Determines whether the server(s) should keep the durable client's queue alive for the duration of the timeout when the client voluntarily disconnects.boolean
Determines whether this GemFire cache client is ready for events.void
Inform the Apache Geode cluster that thisClientCache
is ready to receive events iff the client is non-durable.protected Pool
protected Properties
Resolves the Apache GeodeProperties
used to configure theClientCache
.void
setClientCacheConfigurers
(List<ClientCacheConfigurer> clientCacheConfigurers) Null-safe operation to set anList
ofClientCacheConfigurers
to apply additional configuration to thisClientCacheFactoryBean
when using Annotation-based configuration.void
setClientCacheConfigurers
(ClientCacheConfigurer... clientCacheConfigurers) Null-safe operation to set an array ofClientCacheConfigurers
used to apply additional configuration to thisClientCacheFactoryBean
when using Annotation-based configuration.void
setDurableClientId
(String durableClientId) Set the GemFire System property 'durable-client-id' to indicate to the server that this client is durable.void
setDurableClientTimeout
(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 void
setEnableAutoReconnect
(Boolean enableAutoReconnect) Controls whether auto-reconnect functionality introduced in GemFire 8 is enabled or not.void
setFreeConnectionTimeout
(Integer freeConnectionTimeout) void
setIdleTimeout
(Long idleTimeout) void
setKeepAlive
(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.void
setLoadConditioningInterval
(Integer loadConditioningInterval) void
setLocators
(Iterable<ConnectionEndpoint> locators) void
setLocators
(ConnectionEndpoint[] locators) void
setMaxConnections
(Integer maxConnections) void
setMinConnections
(Integer minConnections) void
setMultiUserAuthentication
(Boolean multiUserAuthentication) void
setPingInterval
(Long pingInterval) void
Sets thePool
used by thisClientCache
to obtain connections to the Apache Geode cluster.void
setPoolName
(String poolName) Sets thename
of thePool
used by thisClientCache
to obtain connections to the Apache Geode cluster.void
setPoolResolver
(PoolResolver poolResolver) void
setPrSingleHopEnabled
(Boolean prSingleHopEnabled) void
setReadTimeout
(Integer readTimeout) void
setReadyForEvents
(Boolean readyForEvents) Sets the readyForEvents property to indicate whether the cache client should notify the server that it is ready to receive updates.void
setRetryAttempts
(Integer retryAttempts) void
setServerConnectionTimeout
(Integer serverConnectionTimeout) void
setServerGroup
(String serverGroup) void
setServers
(Iterable<ConnectionEndpoint> servers) void
setServers
(ConnectionEndpoint[] servers) void
setSocketBufferSize
(Integer socketBufferSize) void
setSocketConnectTimeout
(Integer socketConnectTimeout) void
setSocketFactory
(SocketFactory socketFactory) void
setStatisticsInterval
(Integer statisticsInterval) void
setSubscriptionAckInterval
(Integer subscriptionAckInterval) void
setSubscriptionEnabled
(Boolean subscriptionEnabled) void
setSubscriptionMessageTrackingTimeout
(Integer subscriptionMessageTrackingTimeout) void
setSubscriptionRedundancy
(Integer subscriptionRedundancy) void
setThreadLocalConnections
(Boolean threadLocalConnections) final void
setUseClusterConfiguration
(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, setSecurityManager
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, setAndGetProperties, setBeanFactoryLocator, setCacheXml, setProperties, setUseBeanFactoryLocator
Methods 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, 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
-
Field Details
-
DEFAULT_POOL_RESOLVER
-
-
Constructor Details
-
ClientCacheFactoryBean
public ClientCacheFactoryBean()
-
-
Method Details
-
applyCacheConfigurers
protected void applyCacheConfigurers()Applies the compositeClientCacheConfigurers
to thisClientCacheFactoryBean
before theClientCache
is created.- Overrides:
applyCacheConfigurers
in classCacheFactoryBean
- See Also:
-
applyClientCacheConfigurers
Applies the array ofClientCacheConfigurers
to thisClientCacheFactoryBean
before theClientCache
is created.- Parameters:
clientCacheConfigurers
- array ofClientCacheConfigurers
applied to thisClientCacheFactoryBean
.- See Also:
-
applyClientCacheConfigurers
Apples theIterable
ofClientCacheConfigurers
to thisClientCacheFactoryBean
before theClientCache
is created.- Parameters:
clientCacheConfigurers
-Iterable
ofClientCacheConfigurers
applied to thisClientCacheFactoryBean
.- See Also:
-
doFetchCache
Fetches an existingClientCache
instance from theClientCacheFactory
.- Overrides:
doFetchCache
in classCacheFactoryBean
- Type Parameters:
T
- parameterizedClass
type extension ofGemFireCache
.- Returns:
- an existing
ClientCache
instance if available. - Throws:
CacheClosedException
- if an existingClientCache
instance does not exist.- See Also:
-
doGetObjectType
Returns thetype
ofGemFireCache
constructed by thisClientCacheFactoryBean
. ReturnsClientCache
Class
.- Overrides:
doGetObjectType
in classCacheFactoryBean
- Returns:
- the
type
ofGemFireCache
constructed by thisClientCacheFactoryBean
. - See Also:
-
resolveProperties
Resolves the Apache GeodeProperties
used to configure theClientCache
.- Overrides:
resolveProperties
in classAbstractConfigurableCacheFactoryBean
- Returns:
- the resolved Apache Geode
Properties
used to configure theClientCache
. - See Also:
-
createFactory
Constructs a new instance ofClientCacheFactory
initialized with the given Apache GeodeProperties
used to construct, configure and initialize a newClientCache
instance.- Overrides:
createFactory
in classCacheFactoryBean
- Parameters:
gemfireProperties
-Properties
used by theClientCacheFactory
to configure theClientCache
.- Returns:
- a new instance of
ClientCacheFactory
initialized with the given Apache GeodeProperties
. - See Also:
-
configureFactory
Configures theClientCacheFactory
used to create theClientCache
.- Overrides:
configureFactory
in classCacheFactoryBean
- Parameters:
factory
-ClientCacheFactory
used to create theClientCache
.- Returns:
- the configured
ClientCacheFactory
. - See Also:
-
configurePdx
Configures theClientCache
to use PDX serialization.- Parameters:
clientCacheFactory
-ClientCacheFactory
to configure with PDX.- Returns:
- the given
ClientCacheFactory
. - See Also:
-
configurePool
Configure the DEFAULTPool
of theClientCacheFactory
using a givenPool
instance or a namedPool
instance.- Parameters:
clientCacheFactory
-ClientCacheFactory
used to configure the DEFAULTPool
.- See Also:
-
resolvePool
- Returns:
- the resolved
Pool
used to configure theClientCache
, DEFAULTPool
. - See Also:
-
PoolManager.find(String)
Pool
getPoolName()
getPool()
findPool(String)
isPoolNameResolvable(String)
-
createCache
Creates a newClientCache
instance using the providedfactory
.- Overrides:
createCache
in classCacheFactoryBean
- Type Parameters:
T
- parameterizedClass
type extendingGemFireCache
.- Parameters:
factory
- instance ofClientCacheFactory
.- Returns:
- a new instance of
ClientCache
created by the provided factory. - See Also:
-
onApplicationEvent
Inform the Apache Geode cluster that thisClientCache
is ready to receive events iff the client is non-durable.- Specified by:
onApplicationEvent
in interfaceApplicationListener<ContextRefreshedEvent>
- Parameters:
event
-ApplicationContextEvent
fired when theApplicationContext
is refreshed.- See Also:
-
close
Null-safe internal method used to close theClientCache
and preserve durability.- Overrides:
close
in classAbstractBasicCacheFactoryBean
- Parameters:
cache
-GemFireCache
to close.- See Also:
-
addLocators
-
addLocators
-
addServers
-
addServers
-
setClientCacheConfigurers
Null-safe operation to set an array ofClientCacheConfigurers
used to apply additional configuration to thisClientCacheFactoryBean
when using Annotation-based configuration.- Parameters:
clientCacheConfigurers
- array ofClientCacheConfigurers
used to apply additional configuration to thisClientCacheFactoryBean
.- See Also:
-
setClientCacheConfigurers
Null-safe operation to set anList
ofClientCacheConfigurers
to apply additional configuration to thisClientCacheFactoryBean
when using Annotation-based configuration.- Parameters:
clientCacheConfigurers
-List
ofClientCacheConfigurers
used to apply additional configuration to thisClientCacheFactoryBean
.- See Also:
-
getCompositeClientCacheConfigurer
Returns a reference to the CompositeClientCacheConfigurer
used to apply additional configuration to thisClientCacheFactoryBean
on 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:CacheFactoryBean
Controls whether auto-reconnect functionality introduced in GemFire 8 is enabled or not.- Overrides:
setEnableAutoReconnect
in classCacheFactoryBean
- Parameters:
enableAutoReconnect
- a boolean value to enable/disable auto-reconnect functionality.
-
getEnableAutoReconnect
Description copied from class:CacheFactoryBean
Gets the value for the auto-reconnect setting.- Overrides:
getEnableAutoReconnect
in 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 thePool
used by thisClientCache
to obtain connections to the Apache Geode cluster.- Parameters:
pool
-Pool
used by thisClientCache
to obtain connections to the Apache Geode cluster.- See Also:
-
getPool
Gets thePool
used by thisClientCache
to obtain connections to the Apache Geode cluster.- Returns:
Pool
used by thisClientCache
to obtain connections to the Apache Geode cluster.- See Also:
-
setPoolName
Sets thename
of thePool
used by thisClientCache
to obtain connections to the Apache Geode cluster.- Parameters:
poolName
-name
of thePool
used by thisClientCache
to obtain connections to the Apache Geode cluster.
-
getPoolName
Gets thename
of thePool
used by thisClientCache
to obtain connections to the Apache Geode cluster.- Returns:
name
of thePool
used by thisClientCache
to obtain connections to the Apache Geode cluster.
-
setPoolResolver
Sets (configures) thePoolResolver
used by thisClientCache
to resolvePool
objects. ThePool
objects may be managed or un-managed depending on thePoolResolver
implementation.- Parameters:
poolResolver
-PoolResolver
used to resolve the configuredPool
.- See Also:
-
getPoolResolver
- Returns:
- the configured
PoolResolver
. If noPoolResolver
was 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
Boolean
indicating 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:CacheFactoryBean
Sets the state of the use-shared-configuration Pivotal GemFire/Apache Geode distribution configuration setting.- Overrides:
setUseClusterConfiguration
in classCacheFactoryBean
- Parameters:
useClusterConfiguration
- boolean value to set the use-shared-configuration Pivotal GemFire/Apache Geode distribution configuration setting.
-
getUseClusterConfiguration
Description copied from class:CacheFactoryBean
Return the state of the use-shared-configuration Pivotal GemFire/Apache Geode distribution configuration setting.- Overrides:
getUseClusterConfiguration
in classCacheFactoryBean
- Returns:
- the current boolean value for the use-shared-configuration Pivotal GemFire/Apache Geode distribution configuration setting.
-