Class CacheTypeAwareRegionFactoryBean<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.config.annotation.support.CacheTypeAwareRegionFactoryBean<K,V>
- All Implemented Interfaces:
Aware,BeanClassLoaderAware,BeanFactoryAware,BeanNameAware,FactoryBean<Region<K,,V>> InitializingBean,Lifecycle,Phased,SmartLifecycle,EvictingRegionFactoryBean,ExpiringRegionFactoryBean<K,V>
public class CacheTypeAwareRegionFactoryBean<K,V>
extends ResolvableRegionFactoryBean<K,V>
implements EvictingRegionFactoryBean, ExpiringRegionFactoryBean<K,V>, SmartLifecycle
The
CacheTypeAwareRegionFactoryBean class is a smart Spring FactoryBean that knows how to
create a client or server Region depending on whether the GemFireCache is a ClientCache
or a peer Cache.- Since:
- 1.9.0
- Author:
- John Blum
- See Also:
-
CacheCustomExpiryDataPolicyEvictionAttributesExpirationAttributesGemFireCacheRegionRegionAttributesRegionShortcutScopeClientCacheClientRegionShortcutCompressorGenericRegionFactoryBeanLocalRegionFactoryBeanPartitionedRegionFactoryBeanPeerRegionFactoryBeanResolvableRegionFactoryBeanReplicatedRegionFactoryBeanClientRegionFactoryBeanRegionConfigurerEvictingRegionFactoryBeanExpiringRegionFactoryBean
-
Field Summary
Fields 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.context.SmartLifecycle
DEFAULT_PHASE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidconfigureEviction(EvictingRegionFactoryBean regionFactoryBean) protected voidconfigureExpiration(ExpiringRegionFactoryBean<K, V> regionFactoryBean) createRegion(GemFireCache gemfireCache, String regionName) protected RegionAttributes<K,V> protected ClientRegionShortcutprotected BooleangetClose()protected CompressorReturns the configuredCompressorused to compress the thisRegion'sdata.protected CustomExpiry<K,V> protected CustomExpiry<K,V> protected DataPolicyprotected Stringprotected ExpirationAttributesprotected ExpirationAttributesprotected EvictionAttributesprotected BooleanReturn the configuration setting for whether theRegion'sdata will be managed in Off-Heap Memory.intgetPhase()protected ExpirationAttributesprotected ExpirationAttributesprotected ScopegetScope()protected RegionShortcutprotected Optional<SmartLifecycle>booleanprotected booleanisClose()booleannewClientRegion(GemFireCache gemfireCache, String regionName) Constructs, configures and initialize\s a new clientRegionusing theClientRegionFactoryBean.protected <K,V> ClientRegionFactoryBean<K, V> Constructs a new instance of theClientRegionFactoryBean.protected PeerRegionFactoryBean<K,V> Constructs asub-typeof thePeerRegionFactoryBeanclass based on thegetServerRegionShortcut()andgetDataPolicy().newServerRegion(GemFireCache gemfireCache, String regionName) Constructs, configures and initializes a new serverRegionusing a sub-class ofPeerRegionFactoryBean.protected StringvoidsetAttributes(RegionAttributes<K, V> regionAttributes) voidsetClientRegionShortcut(ClientRegionShortcut clientRegionShortcut) voidvoidsetCompressor(Compressor compressor) Configures theCompressorused to compress the thisRegion'sdata.voidsetCustomEntryIdleTimeout(CustomExpiry<K, V> customEntryIdleTimeout) voidsetCustomEntryTimeToLive(CustomExpiry<K, V> customEntryTimeToLive) voidsetDataPolicy(DataPolicy dataPolicy) voidsetDiskStoreName(String diskStoreName) voidsetEntryIdleTimeout(ExpirationAttributes entryIdleTimeout) voidsetEntryTimeToLive(ExpirationAttributes entryTimeToLive) voidsetEvictionAttributes(EvictionAttributes evictionAttributes) voidsetInterests(Interest<K>[] interests) voidsetKeyConstraint(Class<K> keyConstraint) voidsetOffHeap(Boolean offHeap) Configure theRegionto manage data in Off-Heap Memory.voidsetPoolName(String poolName) voidsetRegionConfigurers(List<RegionConfigurer> regionConfigurers) Null-safe operation used to set anIterableofRegionConfigurersused to apply additional configuration to thisResolvableRegionFactoryBeanwhen using Annotation-based configuration.voidsetRegionConfigurers(RegionConfigurer... regionConfigurers) Null-safe operation used to set an array ofRegionConfigurersused to apply additional configuration to thisResolvableRegionFactoryBeanwhen using Annotation-based configuration.voidsetRegionIdleTimeout(ExpirationAttributes regionIdleTimeout) voidsetRegionTimeToLive(ExpirationAttributes regionTimeToLive) voidvoidsetServerRegionShortcut(RegionShortcut shortcut) voidsetStatisticsEnabled(Boolean statisticsEnabled) voidsetValueConstraint(Class<V> valueConstraint) voidstart()voidstop()voidMethods inherited from class org.springframework.data.gemfire.ResolvableRegionFactoryBean
afterPropertiesSet, getCache, getLookupEnabled, getObject, getObjectType, getParent, getRegion, isLookupEnabled, loadSnapshot, postProcess, resolveRegionName, setCache, setLookupEnabled, setName, setParent, setRegion, setRegionName, setSnapshotMethods 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
-
Constructor Details
-
CacheTypeAwareRegionFactoryBean
public CacheTypeAwareRegionFactoryBean()
-
-
Method Details
-
createRegion
Description copied from class:ResolvableRegionFactoryBeanCreates a newRegionwith the givenname. This method gets called when aRegionwith the specifiednamedoes not already exist. By default, this method implementation throws aBeanInitializationExceptionand it is expected thatsubclasseswill override this method.- Overrides:
createRegionin classResolvableRegionFactoryBean<K,V> - Parameters:
gemfireCache- reference to theGemFireCache.regionName-nameof the newRegion.- Returns:
- a new
Regionwith the givenname. - Throws:
BeanInitializationException- by default unless asubclassoverrides this method.Exception- See Also:
-
newClientRegion
protected Region<K,V> newClientRegion(GemFireCache gemfireCache, String regionName) throws Exception Constructs, configures and initialize\s a new clientRegionusing theClientRegionFactoryBean.- Parameters:
gemfireCache- reference to theGemFireCacheused to create/initialize the factory used to create the clientRegion.regionName- name given to the clientRegion.- Returns:
- a new instance of a client
Regionwith the givenregionName. - Throws:
Exception- if the clientRegioncould not be created.- See Also:
-
newClientRegionFactoryBean
Constructs a new instance of theClientRegionFactoryBean.- Type Parameters:
K-typeof the createdRegion'skey.V-typeof the createdRegion'svalue.- Returns:
- a new instance of the
ClientRegionFactoryBean. - See Also:
-
newServerRegion
protected Region<K,V> newServerRegion(GemFireCache gemfireCache, String regionName) throws Exception Constructs, configures and initializes a new serverRegionusing a sub-class ofPeerRegionFactoryBean.- Parameters:
gemfireCache- reference to theGemFireCacheused to create/initialize the factory used to create the serverRegion.regionName- name given to the serverRegion.- Returns:
- a new instance of a server
Regionwith the givenregionName. - Throws:
Exception- if the serverRegioncould not be created.- See Also:
-
newPeerRegionFactoryBean
Constructs asub-typeof thePeerRegionFactoryBeanclass based on thegetServerRegionShortcut()andgetDataPolicy().- Returns:
- a new instance of the
PeerRegionFactoryBean. - See Also:
-
configureEviction
-
configureExpiration
-
setAttributes
-
getAttributes
-
setClientRegionShortcut
-
getClientRegionShortcut
-
setClose
-
getClose
-
isClose
protected boolean isClose() -
setCompressor
Configures theCompressorused to compress the thisRegion'sdata.- Parameters:
compressor-Compressorused to compress the thisRegion'sdata.- See Also:
-
getCompressor
Returns the configuredCompressorused to compress the thisRegion'sdata.- Returns:
- the configured
Compressorused to compress the thisRegion'sdata. - See Also:
-
setCustomEntryIdleTimeout
- Specified by:
setCustomEntryIdleTimeoutin interfaceExpiringRegionFactoryBean<K,V>
-
getCustomEntryIdleTimeout
-
setCustomEntryTimeToLive
- Specified by:
setCustomEntryTimeToLivein interfaceExpiringRegionFactoryBean<K,V>
-
getCustomEntryTimeToLive
-
setDataPolicy
-
getDataPolicy
-
setDiskStoreName
-
getDiskStoreName
-
setEvictionAttributes
- Specified by:
setEvictionAttributesin interfaceEvictingRegionFactoryBean
-
getEvictionAttributes
-
setEntryIdleTimeout
- Specified by:
setEntryIdleTimeoutin interfaceExpiringRegionFactoryBean<K,V>
-
getEntryIdleTimeout
-
setEntryTimeToLive
- Specified by:
setEntryTimeToLivein interfaceExpiringRegionFactoryBean<K,V>
-
getEntryTimeToLive
-
setInterests
-
getInterests
-
setKeyConstraint
-
getKeyConstraint
-
setOffHeap
Configure theRegionto manage data in Off-Heap Memory.- Parameters:
offHeap- boolean value indicating whether theRegion'sdata will be managed in Off-Heap Memory.
-
getOffHeap
Return the configuration setting for whether theRegion'sdata will be managed in Off-Heap Memory.- Returns:
- a boolean value indicating whether the
Region'sdata will be managed in Off-Heap Memory.
-
setPoolName
-
getPoolName
-
resolvePoolName
-
setRegionConfigurers
Null-safe operation used to set an array ofRegionConfigurersused to apply additional configuration to thisResolvableRegionFactoryBeanwhen using Annotation-based configuration.- Parameters:
regionConfigurers- array ofRegionConfigurersused to apply additional configuration to thisResolvableRegionFactoryBean.- See Also:
-
setRegionConfigurers
Null-safe operation used to set anIterableofRegionConfigurersused to apply additional configuration to thisResolvableRegionFactoryBeanwhen using Annotation-based configuration.- Parameters:
regionConfigurers-IterableofRegionConfigurersused to apply additional configuration to thisResolvableRegionFactoryBean.- See Also:
-
setRegionIdleTimeout
- Specified by:
setRegionIdleTimeoutin interfaceExpiringRegionFactoryBean<K,V>
-
getRegionIdleTimeout
-
setRegionTimeToLive
- Specified by:
setRegionTimeToLivein interfaceExpiringRegionFactoryBean<K,V>
-
getRegionTimeToLive
-
setScope
-
getScope
-
setServerRegionShortcut
-
getServerRegionShortcut
-
getSmartLifecycleComponent
-
setStatisticsEnabled
-
getStatisticsEnabled
-
setValueConstraint
-
getValueConstraint
-
isAutoStartup
public boolean isAutoStartup()- Specified by:
isAutoStartupin interfaceSmartLifecycle
-
isRunning
public boolean isRunning() -
getPhase
public int getPhase()- Specified by:
getPhasein interfacePhased- Specified by:
getPhasein interfaceSmartLifecycle
-
start
public void start() -
stop
public void stop() -
stop
- Specified by:
stopin interfaceSmartLifecycle
-