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:
-
CacheListenerCacheLoaderCacheWriterCustomExpiryDataPolicyEvictionAttributesExpirationAttributesGemFireCacheRegionRegionAttributesClientCacheClientRegionFactoryClientRegionShortcutPoolCompressorDisposableBeanFactoryBeanConfigurableRegionFactoryBeanPoolResolverRegionConfigurerEvictingRegionFactoryBeanExpiringRegionFactoryBeanSmartLifecycleSupport
-
Field Summary
FieldsFields inherited from class org.springframework.data.gemfire.ResolvableRegionFactoryBean
CREATING_REGION_LOG_MESSAGE, REGION_FOUND_LOG_MESSAGE, REGION_NOT_FOUND_ERROR_MESSAGEFields inherited from class org.springframework.data.gemfire.support.AbstractFactoryBeanSupport
DEFAULT_SINGLETONFields inherited from interface org.springframework.beans.factory.FactoryBean
OBJECT_TYPE_ATTRIBUTEFields inherited from interface org.springframework.data.gemfire.support.SmartLifecycleSupport
DEFAULT_AUTO_STARTUP, DEFAULT_IS_RUNNING, DEFAULT_PHASE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidInitializes a the instance ofClientRegionFactoryBean.protected ClientRegionFactory<K,V> configure(ClientRegionFactory<K, V> clientRegionFactory) Configures the givenClientRegionFactoryBeanfrom the configuration settings of thisClientRegionFactoryBeanand anyRegionAttributes.protected ClientRegionFactory<K,V> createClientRegionFactory(ClientCache clientCache, ClientRegionShortcut clientRegionShortcut) Constructs a new instance ofClientRegionFactoryusing the givenClientCacheandClientRegionShortcut.createRegion(GemFireCache gemfireCache, String regionName) voiddestroy()Closes and destroys theRegion.protected RegionAttributes<K,V> Gets theRegionAttributesused to configure theclient Regioncreated by thisClientRegionFactoryBean.Gets a reference to the configured, defaultPoolResolverused by this clientRegionto resolvePoolobjects if a explicitPoolResolverwas not configured.protected booleanprotected booleanbooleanprotected ClientRegionFactory<K,V> postProcess(ClientRegionFactory<K, V> clientRegionFactory) Post-process the givenClientRegionFactorysetup by thisClientRegionFactoryBean.postProcess(Region<K, V> region) Post-process theRegioncreated by thisClientRegionFactoryBean.protected booleanvoidsetAttributes(RegionAttributes<K, V> attributes) Sets the region attributes used for the region used by this factory.voidsetCacheListeners(CacheListener<K, V>[] cacheListeners) Sets the cache listeners used for the region used by this factory.voidsetCacheLoader(CacheLoader<K, V> cacheLoader) Sets the CacheLoader used to load data local to the client's Region on cache misses.voidsetCacheWriter(CacheWriter<K, V> cacheWriter) Sets the CacheWriter used to perform a synchronous write-behind when data is put into the client's Region.voidsetCloningEnabled(Boolean cloningEnabled) voidsetClose(boolean close) Indicates whether the region referred by this factory bean will be closed on shutdown (default true).voidsetCompressor(Compressor compressor) Configures theCompressorused to compress the thisRegion'sdata.voidsetConcurrencyChecksEnabled(Boolean concurrencyChecksEnabled) voidsetConcurrencyLevel(Integer concurrencyLevel) voidsetCustomEntryIdleTimeout(CustomExpiry<K, V> customEntryIdleTimeout) voidsetCustomEntryTimeToLive(CustomExpiry<K, V> customEntryTimeToLive) voidsetDataPolicy(DataPolicy dataPolicy) Sets the Data Policy.voidsetDestroy(boolean destroy) Indicates whether the region referred by this factory bean will be destroyed on shutdown (default false).voidsetDiskStoreName(String diskStoreName) Sets the name of disk store to use for overflow and persistencevoidsetDiskSynchronous(Boolean diskSynchronous) voidsetEntryIdleTimeout(ExpirationAttributes entryIdleTimeout) voidsetEntryTimeToLive(ExpirationAttributes entryTimeToLive) voidsetEvictionAttributes(EvictionAttributes evictionAttributes) voidsetInitialCapacity(Integer initialCapacity) voidsetInterests(Interest<K>[] interests) Set the interests for this client region.voidsetKeyConstraint(Class<K> keyConstraint) Sets atypeconstraint on thisclient Region'skeys.voidsetLoadFactor(Float loadFactor) voidsetPersistent(boolean persistent) Configures whether thisclient Regionis persistent, i.e. stores data to disk.voidvoidsetPoolName(String poolName) voidsetPoolResolver(PoolResolver poolResolver) voidsetRegionIdleTimeout(ExpirationAttributes regionIdleTimeout) voidsetRegionTimeToLive(ExpirationAttributes regionTimeToLive) voidsetShortcut(ClientRegionShortcut shortcut) voidsetStatisticsEnabled(Boolean statisticsEnabled) voidsetValueConstraint(Class<V> valueConstraint) Sets atypeconstraint on thisclient Region'svalues.voidstart()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, setRegionConfigurersMethods inherited from class org.springframework.data.gemfire.ResolvableRegionFactoryBean
getCache, getLookupEnabled, getObject, getObjectType, getParent, getRegion, isLookupEnabled, loadSnapshot, resolveRegionName, setCache, setLookupEnabled, setName, setParent, setRegion, setRegionName, setSnapshotMethods 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, setBeanNameMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:
afterPropertiesSetin interfaceInitializingBean- Overrides:
afterPropertiesSetin classConfigurableRegionFactoryBean<K,V> - Throws:
Exception- if initialization fails.- See Also:
-
createRegion
- Overrides:
createRegionin classResolvableRegionFactoryBean<K,V> - Parameters:
gemfireCache- reference to theGemFireCache.regionName-nameof the newRegion.- Returns:
- a new
Regionwith the givenname. - See Also:
-
createClientRegionFactory(ClientCache, ClientRegionShortcut)newRegion(ClientRegionFactory, Region, String)GemFireCacheRegion
-
createClientRegionFactory
protected ClientRegionFactory<K,V> createClientRegionFactory(ClientCache clientCache, ClientRegionShortcut clientRegionShortcut) Constructs a new instance ofClientRegionFactoryusing the givenClientCacheandClientRegionShortcut.- Parameters:
clientCache- reference to theClientCache.clientRegionShortcut-ClientRegionShortcutused to configure theclient RegionDataPolicy.- Returns:
- a new instance of
ClientRegionFactory. - See Also:
-
configure
Configures the givenClientRegionFactoryBeanfrom the configuration settings of thisClientRegionFactoryBeanand anyRegionAttributes.- Parameters:
clientRegionFactory-ClientRegionFactoryto configure.- Returns:
- the configured
ClientRegionFactory. - See Also:
-
postProcess
Post-process the givenClientRegionFactorysetup by thisClientRegionFactoryBean.- Parameters:
clientRegionFactory-ClientRegionFactoryto process.- Returns:
- the given
ClientRegionFactory. - See Also:
-
postProcess
Post-process theRegioncreated by thisClientRegionFactoryBean.- Overrides:
postProcessin classResolvableRegionFactoryBean<K,V> - Parameters:
region-Regionto process.- See Also:
-
start
public void start()Registers interests in the startup lifecycle phase of the Spring container.- Specified by:
startin interfaceLifecycle- See Also:
-
ResolvableRegionFactoryBean.getRegion()registerInterests(Region)
-
destroy
Closes and destroys theRegion.- Specified by:
destroyin 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 theRegionAttributesused to configure theclient Regioncreated by thisClientRegionFactoryBean.- Returns:
- the
RegionAttributesused 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 theCompressorused to compress the thisRegion'sdata.- Parameters:
compressor-Compressorused to compress the thisRegion'sdata.- See Also:
-
setConcurrencyChecksEnabled
-
setConcurrencyLevel
-
setCustomEntryIdleTimeout
- Specified by:
setCustomEntryIdleTimeoutin interfaceExpiringRegionFactoryBean<K,V>
-
setCustomEntryTimeToLive
- Specified by:
setCustomEntryTimeToLivein 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:
setEntryIdleTimeoutin interfaceExpiringRegionFactoryBean<K,V>
-
setEntryTimeToLive
- Specified by:
setEntryTimeToLivein interfaceExpiringRegionFactoryBean<K,V>
-
setEvictionAttributes
- Specified by:
setEvictionAttributesin 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 atypeconstraint on thisclient Region'skeys.- Parameters:
keyConstraint-typeof thisclient Region'skeys.- See Also:
-
setLoadFactor
-
isPersistent
protected boolean isPersistent() -
isNotPersistent
protected boolean isNotPersistent() -
setPersistent
public void setPersistent(boolean persistent) Configures whether thisclient Regionis persistent, i.e. stores data to disk.- Parameters:
persistent- boolean value used to enable disk persistence.
-
setPool
-
setPoolName
-
getPoolName
-
setPoolResolver
Sets (configures) thePoolResolverused by this clientRegionto 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:
-
getDefaultPoolResolver
Gets a reference to the configured, defaultPoolResolverused by this clientRegionto resolvePoolobjects if a explicitPoolResolverwas not configured. The defaultPoolResolveruses a composition of theBeanFactoryPoolResolverandPoolManagerPoolResolverto fallback on.- Returns:
- the default
PoolResolver. - See Also:
-
setRegionIdleTimeout
- Specified by:
setRegionIdleTimeoutin interfaceExpiringRegionFactoryBean<K,V>
-
setRegionTimeToLive
- Specified by:
setRegionTimeToLivein interfaceExpiringRegionFactoryBean<K,V>
-
setShortcut
- Parameters:
shortcut-ClientRegionShortcutused to initialize theDataPolicyof thisclient Region.- See Also:
-
setStatisticsEnabled
-
getStatisticsEnabled
-
isStatisticsEnabled
public boolean isStatisticsEnabled() -
resolveStatisticsEnabled
protected boolean resolveStatisticsEnabled() -
setValueConstraint
Sets atypeconstraint on thisclient Region'svalues.- Parameters:
valueConstraint-typeof thisclient Region'svalues.- See Also:
-