Class ClientRegionFactoryBean<K,V>
java.lang.Object
org.springframework.data.gemfire.support.AbstractFactoryBeanSupport<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:
Aware
,BeanClassLoaderAware
,BeanFactoryAware
,BeanNameAware
,DisposableBean
,FactoryBean<Region<K,
,V>> InitializingBean
,Lifecycle
,Phased
,SmartLifecycle
,EvictingRegionFactoryBean
,ExpiringRegionFactoryBean<K,
,V> SmartLifecycleSupport
public class ClientRegionFactoryBean<K,V>
extends ConfigurableRegionFactoryBean<K,V>
implements SmartLifecycleSupport, EvictingRegionFactoryBean, ExpiringRegionFactoryBean<K,V>, DisposableBean
Spring
FactoryBean
used to construct, configure and initialize a client Region
.- Author:
- Costin Leau, David Turanski, John Blum
- 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
.protected ClientRegionFactory<K,
V> configure
(ClientRegionFactory<K, V> clientRegionFactory) Configures the givenClientRegionFactoryBean
from the configuration settings of thisClientRegionFactoryBean
and anyRegionAttributes
.protected ClientRegionFactory<K,
V> createClientRegionFactory
(ClientCache clientCache, ClientRegionShortcut clientRegionShortcut) Constructs a new instance ofClientRegionFactory
using the givenClientCache
andClientRegionShortcut
.createRegion
(GemFireCache gemfireCache, String regionName) void
destroy()
Closes and destroys theRegion
.protected RegionAttributes<K,
V> 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
protected ClientRegionFactory<K,
V> postProcess
(ClientRegionFactory<K, V> clientRegionFactory) Post-process the givenClientRegionFactory
setup by thisClientRegionFactoryBean
.postProcess
(Region<K, V> region) Post-process theRegion
created by thisClientRegionFactoryBean
.protected boolean
void
setAttributes
(RegionAttributes<K, V> attributes) Sets the region attributes used for the region used by this factory.void
setCacheListeners
(CacheListener<K, V>[] cacheListeners) Sets the cache listeners used for the region used by this factory.void
setCacheLoader
(CacheLoader<K, V> cacheLoader) Sets the CacheLoader used to load data local to the client's Region on cache misses.void
setCacheWriter
(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
(Compressor compressor) Configures theCompressor
used to compress the thisRegion's
data.void
setConcurrencyChecksEnabled
(Boolean concurrencyChecksEnabled) void
setConcurrencyLevel
(Integer concurrencyLevel) void
setCustomEntryIdleTimeout
(CustomExpiry<K, V> customEntryIdleTimeout) void
setCustomEntryTimeToLive
(CustomExpiry<K, V> customEntryTimeToLive) void
setDataPolicy
(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
(ExpirationAttributes entryIdleTimeout) void
setEntryTimeToLive
(ExpirationAttributes entryTimeToLive) void
setEvictionAttributes
(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. stores data to disk.void
void
setPoolName
(String poolName) void
setPoolResolver
(PoolResolver poolResolver) void
setRegionIdleTimeout
(ExpirationAttributes regionIdleTimeout) void
setRegionTimeToLive
(ExpirationAttributes regionTimeToLive) void
setShortcut
(ClientRegionShortcut shortcut) 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 interfaceInitializingBean
- Overrides:
afterPropertiesSet
in classConfigurableRegionFactoryBean<K,
V> - Throws:
Exception
- if initialization fails.- See Also:
-
createRegion
- 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 ClientRegionFactory<K,V> createClientRegionFactory(ClientCache clientCache, 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:
-
configure
Configures the givenClientRegionFactoryBean
from the configuration settings of thisClientRegionFactoryBean
and anyRegionAttributes
.- Parameters:
clientRegionFactory
-ClientRegionFactory
to configure.- Returns:
- the configured
ClientRegionFactory
. - See Also:
-
postProcess
Post-process the givenClientRegionFactory
setup by thisClientRegionFactoryBean
.- Parameters:
clientRegionFactory
-ClientRegionFactory
to process.- Returns:
- the given
ClientRegionFactory
. - See Also:
-
postProcess
Post-process theRegion
created by thisClientRegionFactoryBean
.- Overrides:
postProcess
in classResolvableRegionFactoryBean<K,
V> - Parameters:
region
-Region
to process.- See Also:
-
start
public void start()Registers interests in the startup lifecycle phase of the Spring container.- Specified by:
start
in interfaceLifecycle
- See Also:
-
ResolvableRegionFactoryBean.getRegion()
registerInterests(Region)
-
destroy
Closes and destroys theRegion
.- Specified by:
destroy
in interfaceDisposableBean
- Throws:
Exception
- if destroy fails.- See Also:
-
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:
-
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:
-
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:
-
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
Configures theCompressor
used to compress the thisRegion's
data.- Parameters:
compressor
-Compressor
used to compress the thisRegion's
data.- See Also:
-
setConcurrencyChecksEnabled
-
setConcurrencyLevel
-
setCustomEntryIdleTimeout
- Specified by:
setCustomEntryIdleTimeout
in interfaceExpiringRegionFactoryBean<K,
V>
-
setCustomEntryTimeToLive
- Specified by:
setCustomEntryTimeToLive
in interfaceExpiringRegionFactoryBean<K,
V>
-
setDataPolicy
Sets the Data Policy. Used only when a new Region is created.- Parameters:
dataPolicy
- the client Region's Data Policy.- See Also:
-
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
- Specified by:
setEntryIdleTimeout
in interfaceExpiringRegionFactoryBean<K,
V>
-
setEntryTimeToLive
- Specified by:
setEntryTimeToLive
in interfaceExpiringRegionFactoryBean<K,
V>
-
setEvictionAttributes
- 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.- Parameters:
keyConstraint
-type
of thisclient Region's
keys.- See Also:
-
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
-
setPoolName
-
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
- Specified by:
setRegionIdleTimeout
in interfaceExpiringRegionFactoryBean<K,
V>
-
setRegionTimeToLive
- Specified by:
setRegionTimeToLive
in interfaceExpiringRegionFactoryBean<K,
V>
-
setShortcut
- Parameters:
shortcut
-ClientRegionShortcut
used to initialize theDataPolicy
of thisclient Region
.- See Also:
-
setStatisticsEnabled
-
getStatisticsEnabled
-
isStatisticsEnabled
public boolean isStatisticsEnabled() -
resolveStatisticsEnabled
protected boolean resolveStatisticsEnabled() -
setValueConstraint
Sets atype
constraint on thisclient Region's
values.- Parameters:
valueConstraint
-type
of thisclient Region's
values.- See Also:
-