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:
-
Cache
CustomExpiry
DataPolicy
EvictionAttributes
ExpirationAttributes
GemFireCache
Region
RegionAttributes
RegionShortcut
Scope
ClientCache
ClientRegionShortcut
Compressor
GenericRegionFactoryBean
LocalRegionFactoryBean
PartitionedRegionFactoryBean
PeerRegionFactoryBean
ResolvableRegionFactoryBean
ReplicatedRegionFactoryBean
ClientRegionFactoryBean
RegionConfigurer
EvictingRegionFactoryBean
ExpiringRegionFactoryBean
-
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.context.SmartLifecycle
DEFAULT_PHASE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
configureEviction
(EvictingRegionFactoryBean regionFactoryBean) protected void
configureExpiration
(ExpiringRegionFactoryBean<K, V> regionFactoryBean) createRegion
(GemFireCache gemfireCache, String regionName) protected RegionAttributes<K,
V> protected ClientRegionShortcut
protected Boolean
getClose()
protected Compressor
Returns the configuredCompressor
used to compress the thisRegion's
data.protected CustomExpiry<K,
V> protected CustomExpiry<K,
V> protected DataPolicy
protected String
protected ExpirationAttributes
protected ExpirationAttributes
protected EvictionAttributes
protected Boolean
Return the configuration setting for whether theRegion's
data will be managed in Off-Heap Memory.int
getPhase()
protected ExpirationAttributes
protected ExpirationAttributes
protected Scope
getScope()
protected RegionShortcut
protected Optional<SmartLifecycle>
boolean
protected boolean
isClose()
boolean
newClientRegion
(GemFireCache gemfireCache, String regionName) Constructs, configures and initialize\s a new clientRegion
using theClientRegionFactoryBean
.protected <K,
V> ClientRegionFactoryBean<K, V> Constructs a new instance of theClientRegionFactoryBean
.protected PeerRegionFactoryBean<K,
V> Constructs asub-type
of thePeerRegionFactoryBean
class based on thegetServerRegionShortcut()
andgetDataPolicy()
.newServerRegion
(GemFireCache gemfireCache, String regionName) Constructs, configures and initializes a new serverRegion
using a sub-class ofPeerRegionFactoryBean
.protected String
void
setAttributes
(RegionAttributes<K, V> regionAttributes) void
setClientRegionShortcut
(ClientRegionShortcut clientRegionShortcut) void
void
setCompressor
(Compressor compressor) Configures theCompressor
used to compress the thisRegion's
data.void
setCustomEntryIdleTimeout
(CustomExpiry<K, V> customEntryIdleTimeout) void
setCustomEntryTimeToLive
(CustomExpiry<K, V> customEntryTimeToLive) void
setDataPolicy
(DataPolicy dataPolicy) void
setDiskStoreName
(String diskStoreName) void
setEntryIdleTimeout
(ExpirationAttributes entryIdleTimeout) void
setEntryTimeToLive
(ExpirationAttributes entryTimeToLive) void
setEvictionAttributes
(EvictionAttributes evictionAttributes) void
setInterests
(Interest<K>[] interests) void
setKeyConstraint
(Class<K> keyConstraint) void
setOffHeap
(Boolean offHeap) Configure theRegion
to manage data in Off-Heap Memory.void
setPoolName
(String poolName) void
setRegionConfigurers
(List<RegionConfigurer> regionConfigurers) Null-safe operation used to set anIterable
ofRegionConfigurers
used to apply additional configuration to thisResolvableRegionFactoryBean
when using Annotation-based configuration.void
setRegionConfigurers
(RegionConfigurer... regionConfigurers) Null-safe operation used to set an array ofRegionConfigurers
used to apply additional configuration to thisResolvableRegionFactoryBean
when using Annotation-based configuration.void
setRegionIdleTimeout
(ExpirationAttributes regionIdleTimeout) void
setRegionTimeToLive
(ExpirationAttributes regionTimeToLive) void
void
setServerRegionShortcut
(RegionShortcut shortcut) void
setStatisticsEnabled
(Boolean statisticsEnabled) void
setValueConstraint
(Class<V> valueConstraint) void
start()
void
stop()
void
Methods 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, setSnapshot
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
-
Constructor Details
-
CacheTypeAwareRegionFactoryBean
public CacheTypeAwareRegionFactoryBean()
-
-
Method Details
-
createRegion
Description copied from class:ResolvableRegionFactoryBean
Creates a newRegion
with the givenname
. This method gets called when aRegion
with the specifiedname
does not already exist. By default, this method implementation throws aBeanInitializationException
and it is expected thatsubclasses
will override this method.- Overrides:
createRegion
in classResolvableRegionFactoryBean<K,
V> - Parameters:
gemfireCache
- reference to theGemFireCache
.regionName
-name
of the newRegion
.- Returns:
- a new
Region
with the givenname
. - Throws:
BeanInitializationException
- by default unless asubclass
overrides this method.Exception
- See Also:
-
newClientRegion
protected Region<K,V> newClientRegion(GemFireCache gemfireCache, String regionName) throws Exception Constructs, configures and initialize\s a new clientRegion
using theClientRegionFactoryBean
.- Parameters:
gemfireCache
- reference to theGemFireCache
used to create/initialize the factory used to create the clientRegion
.regionName
- name given to the clientRegion
.- Returns:
- a new instance of a client
Region
with the givenregionName
. - Throws:
Exception
- if the clientRegion
could not be created.- See Also:
-
newClientRegionFactoryBean
Constructs a new instance of theClientRegionFactoryBean
.- Type Parameters:
K
-type
of the createdRegion's
key.V
-type
of the createdRegion's
value.- 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 serverRegion
using a sub-class ofPeerRegionFactoryBean
.- Parameters:
gemfireCache
- reference to theGemFireCache
used to create/initialize the factory used to create the serverRegion
.regionName
- name given to the serverRegion
.- Returns:
- a new instance of a server
Region
with the givenregionName
. - Throws:
Exception
- if the serverRegion
could not be created.- See Also:
-
newPeerRegionFactoryBean
Constructs asub-type
of thePeerRegionFactoryBean
class 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 theCompressor
used to compress the thisRegion's
data.- Parameters:
compressor
-Compressor
used to compress the thisRegion's
data.- See Also:
-
getCompressor
Returns the configuredCompressor
used to compress the thisRegion's
data.- Returns:
- the configured
Compressor
used to compress the thisRegion's
data. - See Also:
-
setCustomEntryIdleTimeout
- Specified by:
setCustomEntryIdleTimeout
in interfaceExpiringRegionFactoryBean<K,
V>
-
getCustomEntryIdleTimeout
-
setCustomEntryTimeToLive
- Specified by:
setCustomEntryTimeToLive
in interfaceExpiringRegionFactoryBean<K,
V>
-
getCustomEntryTimeToLive
-
setDataPolicy
-
getDataPolicy
-
setDiskStoreName
-
getDiskStoreName
-
setEvictionAttributes
- Specified by:
setEvictionAttributes
in interfaceEvictingRegionFactoryBean
-
getEvictionAttributes
-
setEntryIdleTimeout
- Specified by:
setEntryIdleTimeout
in interfaceExpiringRegionFactoryBean<K,
V>
-
getEntryIdleTimeout
-
setEntryTimeToLive
- Specified by:
setEntryTimeToLive
in interfaceExpiringRegionFactoryBean<K,
V>
-
getEntryTimeToLive
-
setInterests
-
getInterests
-
setKeyConstraint
-
getKeyConstraint
-
setOffHeap
Configure theRegion
to manage data in Off-Heap Memory.- Parameters:
offHeap
- boolean value indicating whether theRegion's
data will be managed in Off-Heap Memory.
-
getOffHeap
Return the configuration setting for whether theRegion's
data will be managed in Off-Heap Memory.- Returns:
- a boolean value indicating whether the
Region's
data will be managed in Off-Heap Memory.
-
setPoolName
-
getPoolName
-
resolvePoolName
-
setRegionConfigurers
Null-safe operation used to set an array ofRegionConfigurers
used to apply additional configuration to thisResolvableRegionFactoryBean
when using Annotation-based configuration.- Parameters:
regionConfigurers
- array ofRegionConfigurers
used to apply additional configuration to thisResolvableRegionFactoryBean
.- See Also:
-
setRegionConfigurers
Null-safe operation used to set anIterable
ofRegionConfigurers
used to apply additional configuration to thisResolvableRegionFactoryBean
when using Annotation-based configuration.- Parameters:
regionConfigurers
-Iterable
ofRegionConfigurers
used to apply additional configuration to thisResolvableRegionFactoryBean
.- See Also:
-
setRegionIdleTimeout
- Specified by:
setRegionIdleTimeout
in interfaceExpiringRegionFactoryBean<K,
V>
-
getRegionIdleTimeout
-
setRegionTimeToLive
- Specified by:
setRegionTimeToLive
in interfaceExpiringRegionFactoryBean<K,
V>
-
getRegionTimeToLive
-
setScope
-
getScope
-
setServerRegionShortcut
-
getServerRegionShortcut
-
getSmartLifecycleComponent
-
setStatisticsEnabled
-
getStatisticsEnabled
-
setValueConstraint
-
getValueConstraint
-
isAutoStartup
public boolean isAutoStartup()- Specified by:
isAutoStartup
in interfaceSmartLifecycle
-
isRunning
public boolean isRunning() -
getPhase
public int getPhase()- Specified by:
getPhase
in interfacePhased
- Specified by:
getPhase
in interfaceSmartLifecycle
-
start
public void start() -
stop
public void stop() -
stop
- Specified by:
stop
in interfaceSmartLifecycle
-