Class ClientRegionFactoryBean<K,V>
java.lang.Object
org.springframework.data.gemfire.support.AbstractFactoryBeanSupport<org.apache.geode.cache.Region<K,V>>
org.springframework.data.gemfire.ResolvableRegionFactoryBean<K,V>
org.springframework.data.gemfire.ConfigurableRegionFactoryBean<K,V>
org.springframework.data.gemfire.client.ClientRegionFactoryBean<K,V>
- 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.Region<K,
,V>> org.springframework.beans.factory.InitializingBean
,org.springframework.context.Lifecycle
,org.springframework.context.Phased
,org.springframework.context.SmartLifecycle
,EvictingRegionFactoryBean
,ExpiringRegionFactoryBean<K,
,V> SmartLifecycleSupport
public class ClientRegionFactoryBean<K,V>
extends ConfigurableRegionFactoryBean<K,V>
implements SmartLifecycleSupport, EvictingRegionFactoryBean, ExpiringRegionFactoryBean<K,V>, org.springframework.beans.factory.DisposableBean
Spring
FactoryBean
used to construct, configure and initialize a client Region
.- See Also:
-
CacheListener
CacheLoader
CacheWriter
CustomExpiry
DataPolicy
EvictionAttributes
ExpirationAttributes
GemFireCache
Region
RegionAttributes
ClientCache
ClientRegionFactory
ClientRegionShortcut
Pool
Compressor
DisposableBean
FactoryBean
ConfigurableRegionFactoryBean
PoolResolver
RegionConfigurer
EvictingRegionFactoryBean
ExpiringRegionFactoryBean
SmartLifecycleSupport
-
Field Summary
Fields inherited from class org.springframework.data.gemfire.ResolvableRegionFactoryBean
CREATING_REGION_LOG_MESSAGE, REGION_FOUND_LOG_MESSAGE, REGION_NOT_FOUND_ERROR_MESSAGE
Fields inherited from class org.springframework.data.gemfire.support.AbstractFactoryBeanSupport
DEFAULT_SINGLETON
Fields inherited from interface org.springframework.beans.factory.FactoryBean
OBJECT_TYPE_ATTRIBUTE
Fields inherited from interface org.springframework.data.gemfire.support.SmartLifecycleSupport
DEFAULT_AUTO_STARTUP, DEFAULT_IS_RUNNING, DEFAULT_PHASE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Initializes a the instance ofClientRegionFactoryBean
.Configures the givenClientRegionFactoryBean
from the configuration settings of thisClientRegionFactoryBean
and anyRegionAttributes
.createClientRegionFactory
(org.apache.geode.cache.client.ClientCache clientCache, org.apache.geode.cache.client.ClientRegionShortcut clientRegionShortcut) Constructs a new instance ofClientRegionFactory
using the givenClientCache
andClientRegionShortcut
.createRegion
(org.apache.geode.cache.GemFireCache gemfireCache, String regionName) Creates a newRegion
with the givenname
.void
destroy()
Closes and destroys theRegion
.Gets theRegionAttributes
used to configure theclient Region
created by thisClientRegionFactoryBean
.Gets a reference to the configured, defaultPoolResolver
used by this clientRegion
to resolvePool
objects if a explicitPoolResolver
was not configured.protected boolean
protected boolean
boolean
postProcess
(org.apache.geode.cache.client.ClientRegionFactory<K, V> clientRegionFactory) Post-process the givenClientRegionFactory
setup by thisClientRegionFactoryBean
.postProcess
(org.apache.geode.cache.Region<K, V> region) Post-process theRegion
created by thisClientRegionFactoryBean
.protected boolean
void
setAttributes
(org.apache.geode.cache.RegionAttributes<K, V> attributes) Sets the region attributes used for the region used by this factory.void
setCacheListeners
(org.apache.geode.cache.CacheListener<K, V>[] cacheListeners) Sets the cache listeners used for the region used by this factory.void
setCacheLoader
(org.apache.geode.cache.CacheLoader<K, V> cacheLoader) Sets the CacheLoader used to load data local to the client's Region on cache misses.void
setCacheWriter
(org.apache.geode.cache.CacheWriter<K, V> cacheWriter) Sets the CacheWriter used to perform a synchronous write-behind when data is put into the client's Region.void
setCloningEnabled
(Boolean cloningEnabled) void
setClose
(boolean close) Indicates whether the region referred by this factory bean will be closed on shutdown (default true).void
setCompressor
(org.apache.geode.compression.Compressor compressor) Configures theCompressor
used to compress the thisRegion's
data.void
setConcurrencyChecksEnabled
(Boolean concurrencyChecksEnabled) void
setConcurrencyLevel
(Integer concurrencyLevel) void
setCustomEntryIdleTimeout
(org.apache.geode.cache.CustomExpiry<K, V> customEntryIdleTimeout) void
setCustomEntryTimeToLive
(org.apache.geode.cache.CustomExpiry<K, V> customEntryTimeToLive) void
setDataPolicy
(org.apache.geode.cache.DataPolicy dataPolicy) Sets the Data Policy.void
setDestroy
(boolean destroy) Indicates whether the region referred by this factory bean will be destroyed on shutdown (default false).void
setDiskStoreName
(String diskStoreName) Sets the name of disk store to use for overflow and persistencevoid
setDiskSynchronous
(Boolean diskSynchronous) void
setEntryIdleTimeout
(org.apache.geode.cache.ExpirationAttributes entryIdleTimeout) void
setEntryTimeToLive
(org.apache.geode.cache.ExpirationAttributes entryTimeToLive) void
setEvictionAttributes
(org.apache.geode.cache.EvictionAttributes evictionAttributes) void
setInitialCapacity
(Integer initialCapacity) void
setInterests
(Interest<K>[] interests) Set the interests for this client region.void
setKeyConstraint
(Class<K> keyConstraint) Sets atype
constraint on thisclient Region's
keys.void
setLoadFactor
(Float loadFactor) void
setPersistent
(boolean persistent) Configures whether thisclient Region
is persistent, i.e.void
setPool
(org.apache.geode.cache.client.Pool pool) Configures thePool
used by this clientRegion
.void
setPoolName
(String poolName) void
setPoolResolver
(PoolResolver poolResolver) void
setRegionIdleTimeout
(org.apache.geode.cache.ExpirationAttributes regionIdleTimeout) void
setRegionTimeToLive
(org.apache.geode.cache.ExpirationAttributes regionTimeToLive) void
setShortcut
(org.apache.geode.cache.client.ClientRegionShortcut shortcut) Initializes theDataPolicy
of theclient Region
using the givenClientRegionShortcut
.void
setStatisticsEnabled
(Boolean statisticsEnabled) void
setValueConstraint
(Class<V> valueConstraint) Sets atype
constraint on thisclient Region's
values.void
start()
Registers interests in the startup lifecycle phase of the Spring container.Methods inherited from class org.springframework.data.gemfire.ConfigurableRegionFactoryBean
applyRegionConfigurers, applyRegionConfigurers, applyRegionConfigurers, getCompositeRegionConfigurer, setRegionConfigurers, setRegionConfigurers
Methods inherited from class org.springframework.data.gemfire.ResolvableRegionFactoryBean
getCache, getLookupEnabled, getObject, getObjectType, getParent, getRegion, isLookupEnabled, loadSnapshot, resolveRegionName, setCache, setLookupEnabled, setName, setParent, setRegion, setRegionName, setSnapshot
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
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.data.gemfire.support.SmartLifecycleSupport
getPhase, isAutoStartup, isRunning, stop, stop
-
Field Details
-
DEFAULT_POOL_NAME
- See Also:
-
GEMFIRE_POOL_NAME
- See Also:
-
-
Constructor Details
-
ClientRegionFactoryBean
public ClientRegionFactoryBean()
-
-
Method Details
-
afterPropertiesSet
Initializes a the instance ofClientRegionFactoryBean
.- Specified by:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
- Overrides:
afterPropertiesSet
in classConfigurableRegionFactoryBean<K,
V> - Throws:
Exception
- if initialization fails.- See Also:
-
InitializingBean.afterPropertiesSet()
ResolvableRegionFactoryBean.createRegion(GemFireCache, String)
-
createRegion
protected org.apache.geode.cache.Region<K,V> createRegion(org.apache.geode.cache.GemFireCache gemfireCache, String regionName) Creates a newRegion
with the givenname
.- Overrides:
createRegion
in classResolvableRegionFactoryBean<K,
V> - Parameters:
gemfireCache
- reference to theGemFireCache
.regionName
-name
of the newRegion
.- Returns:
- a new
Region
with the givenname
. - See Also:
-
createClientRegionFactory(ClientCache, ClientRegionShortcut)
newRegion(ClientRegionFactory, Region, String)
GemFireCache
Region
-
createClientRegionFactory
protected org.apache.geode.cache.client.ClientRegionFactory<K,V> createClientRegionFactory(org.apache.geode.cache.client.ClientCache clientCache, org.apache.geode.cache.client.ClientRegionShortcut clientRegionShortcut) Constructs a new instance ofClientRegionFactory
using the givenClientCache
andClientRegionShortcut
.- Parameters:
clientCache
- reference to theClientCache
.clientRegionShortcut
-ClientRegionShortcut
used to configure theclient Region
DataPolicy
.- Returns:
- a new instance of
ClientRegionFactory
. - See Also:
-
ClientCache.createClientRegionFactory(ClientRegionShortcut)
ClientRegionShortcut
ClientRegionFactory
-
configure
protected org.apache.geode.cache.client.ClientRegionFactory<K,V> configure(org.apache.geode.cache.client.ClientRegionFactory<K, V> clientRegionFactory) Configures the givenClientRegionFactoryBean
from the configuration settings of thisClientRegionFactoryBean
and anyRegionAttributes
.- Parameters:
clientRegionFactory
-ClientRegionFactory
to configure.- Returns:
- the configured
ClientRegionFactory
. - See Also:
-
ClientRegionFactory
-
postProcess
protected org.apache.geode.cache.client.ClientRegionFactory<K,V> postProcess(org.apache.geode.cache.client.ClientRegionFactory<K, V> clientRegionFactory) Post-process the givenClientRegionFactory
setup by thisClientRegionFactoryBean
.- Parameters:
clientRegionFactory
-ClientRegionFactory
to process.- Returns:
- the given
ClientRegionFactory
. - See Also:
-
ClientRegionFactory
-
postProcess
Post-process theRegion
created by thisClientRegionFactoryBean
.- Overrides:
postProcess
in classResolvableRegionFactoryBean<K,
V> - Parameters:
region
-Region
to process.- See Also:
-
Region
-
start
public void start()Registers interests in the startup lifecycle phase of the Spring container.- Specified by:
start
in interfaceorg.springframework.context.Lifecycle
- See Also:
-
ResolvableRegionFactoryBean.getRegion()
registerInterests(Region)
-
destroy
Closes and destroys theRegion
.- Specified by:
destroy
in interfaceorg.springframework.beans.factory.DisposableBean
- Throws:
Exception
- if destroy fails.- See Also:
-
DisposableBean
-
setAttributes
Sets the region attributes used for the region used by this factory. Allows maximum control in specifying the region settings. Used only when a new region is created. Note that using this method allows for advanced customization of the region - while it provides a lot of flexibility, note that it's quite easy to create misconfigured regions (especially in a client/server scenario).- Parameters:
attributes
- the attributes to set on a newly created region
-
getAttributes
Gets theRegionAttributes
used to configure theclient Region
created by thisClientRegionFactoryBean
.- Returns:
- the
RegionAttributes
used to configure theclient Region
. - See Also:
-
RegionAttributes
-
setCacheListeners
Sets the cache listeners used for the region used by this factory. Used only when a new region is created.Overrides the settings specified throughsetAttributes(RegionAttributes)
.- Parameters:
cacheListeners
- the cacheListeners to set on a newly created region
-
setCacheLoader
Sets the CacheLoader used to load data local to the client's Region on cache misses.- Parameters:
cacheLoader
- a GemFire CacheLoader used to load data into the client Region.- See Also:
-
CacheLoader
-
setCacheWriter
Sets the CacheWriter used to perform a synchronous write-behind when data is put into the client's Region.- Parameters:
cacheWriter
- the GemFire CacheWriter used to perform synchronous write-behinds on put ops.- See Also:
-
CacheWriter
-
setCloningEnabled
-
setClose
public void setClose(boolean close) Indicates whether the region referred by this factory bean will be closed on shutdown (default true). Note: destroy and close are mutually exclusive. Enabling one will automatically disable the other.- Parameters:
close
- whether to close or not the region- See Also:
-
setCompressor
public void setCompressor(org.apache.geode.compression.Compressor compressor) Configures theCompressor
used to compress the thisRegion's
data.- Parameters:
compressor
-Compressor
used to compress the thisRegion's
data.- See Also:
-
Compressor
-
setConcurrencyChecksEnabled
-
setConcurrencyLevel
-
setCustomEntryIdleTimeout
public void setCustomEntryIdleTimeout(org.apache.geode.cache.CustomExpiry<K, V> customEntryIdleTimeout) - Specified by:
setCustomEntryIdleTimeout
in interfaceExpiringRegionFactoryBean<K,
V>
-
setCustomEntryTimeToLive
public void setCustomEntryTimeToLive(org.apache.geode.cache.CustomExpiry<K, V> customEntryTimeToLive) - Specified by:
setCustomEntryTimeToLive
in interfaceExpiringRegionFactoryBean<K,
V>
-
setDataPolicy
public void setDataPolicy(org.apache.geode.cache.DataPolicy dataPolicy) Sets the Data Policy. Used only when a new Region is created.- Parameters:
dataPolicy
- the client Region's Data Policy.- See Also:
-
DataPolicy
-
setDestroy
public void setDestroy(boolean destroy) Indicates whether the region referred by this factory bean will be destroyed on shutdown (default false). Note: destroy and close are mutually exclusive. Enabling one will automatically disable the other.- Parameters:
destroy
- whether or not to destroy the region- See Also:
-
setDiskStoreName
Sets the name of disk store to use for overflow and persistence- Parameters:
diskStoreName
- a String specifying the 'name' of the client Region Disk Store.
-
setDiskSynchronous
-
setEntryIdleTimeout
public void setEntryIdleTimeout(org.apache.geode.cache.ExpirationAttributes entryIdleTimeout) - Specified by:
setEntryIdleTimeout
in interfaceExpiringRegionFactoryBean<K,
V>
-
setEntryTimeToLive
public void setEntryTimeToLive(org.apache.geode.cache.ExpirationAttributes entryTimeToLive) - Specified by:
setEntryTimeToLive
in interfaceExpiringRegionFactoryBean<K,
V>
-
setEvictionAttributes
public void setEvictionAttributes(org.apache.geode.cache.EvictionAttributes evictionAttributes) - Specified by:
setEvictionAttributes
in interfaceEvictingRegionFactoryBean
-
setInitialCapacity
-
setInterests
Set the interests for this client region. Both key and regex interest are supported.- Parameters:
interests
- the interests to set
-
setKeyConstraint
Sets atype
constraint on thisclient Region's
keys. -
setLoadFactor
-
isPersistent
protected boolean isPersistent() -
isNotPersistent
protected boolean isNotPersistent() -
setPersistent
public void setPersistent(boolean persistent) Configures whether thisclient Region
is persistent, i.e. stores data to disk.- Parameters:
persistent
- boolean value used to enable disk persistence.
-
setPool
public void setPool(org.apache.geode.cache.client.Pool pool) Configures thePool
used by this clientRegion
.- Parameters:
pool
-Pool
used by this clientRegion
to send/receive data to/from the server.- See Also:
-
Pool
setPoolName(String)
-
setPoolName
- Parameters:
poolName
-String
containing the name of the clientPool
to be used by this clientRegion
.- See Also:
-
getPoolName
-
setPoolResolver
Sets (configures) thePoolResolver
used by this clientRegion
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:
-
getDefaultPoolResolver
Gets a reference to the configured, defaultPoolResolver
used by this clientRegion
to resolvePool
objects if a explicitPoolResolver
was not configured. The defaultPoolResolver
uses a composition of theBeanFactoryPoolResolver
andPoolManagerPoolResolver
to fallback on.- Returns:
- the default
PoolResolver
. - See Also:
-
setRegionIdleTimeout
public void setRegionIdleTimeout(org.apache.geode.cache.ExpirationAttributes regionIdleTimeout) - Specified by:
setRegionIdleTimeout
in interfaceExpiringRegionFactoryBean<K,
V>
-
setRegionTimeToLive
public void setRegionTimeToLive(org.apache.geode.cache.ExpirationAttributes regionTimeToLive) - Specified by:
setRegionTimeToLive
in interfaceExpiringRegionFactoryBean<K,
V>
-
setShortcut
public void setShortcut(org.apache.geode.cache.client.ClientRegionShortcut shortcut) Initializes theDataPolicy
of theclient Region
using the givenClientRegionShortcut
.- Parameters:
shortcut
-ClientRegionShortcut
used to initialize theDataPolicy
of thisclient Region
.- See Also:
-
ClientRegionShortcut
-
setStatisticsEnabled
-
getStatisticsEnabled
-
isStatisticsEnabled
public boolean isStatisticsEnabled() -
resolveStatisticsEnabled
protected boolean resolveStatisticsEnabled() -
setValueConstraint
Sets atype
constraint on thisclient Region's
values.
-