public abstract class PeerRegionFactoryBean<K,V> extends ConfigurableRegionFactoryBean<K,V> implements DisposableBean, EvictingRegionFactoryBean, ExpiringRegionFactoryBean<K,V>, SmartLifecycle
FactoryBean
and abstract base class extended by other SDG FactoryBeans
used to construct, configure and initialize peer Regions
.
This FactoryBean
allows for very easy and flexible creation of peer Regions
.
For client Regions
, see the ClientRegionFactoryBean
.Cache
,
CacheListener
,
CacheLoader
,
CacheWriter
,
CustomExpiry
,
DataPolicy
,
DiskStore
,
EvictionAttributes
,
ExpirationAttributes
,
GemFireCache
,
PartitionAttributes
,
Region
,
RegionAttributes
,
RegionFactory
,
RegionShortcut
,
Scope
,
AsyncEventQueue
,
GatewaySender
,
Compressor
,
DisposableBean
,
SmartLifecycle
,
ConfigurableRegionFactoryBean
,
ResolvableRegionFactoryBean
,
ClientRegionFactoryBean
,
EvictingRegionFactoryBean
,
ExpiringRegionFactoryBean
,
RegionConfigurer
DEFAULT_SINGLETON
DEFAULT_PHASE
OBJECT_TYPE_ATTRIBUTE
Constructor and Description |
---|
PeerRegionFactoryBean() |
Modifier and Type | Method and Description |
---|---|
void |
addAsyncEventQueueIds(String[] asyncEventQueueIds)
Registers the array of
AsyncEventQueues (AEQ) with this Region
by ID by appending to the already existing, registered AEQs for this Region . |
void |
addAsyncEventQueues(org.apache.geode.cache.asyncqueue.AsyncEventQueue[] asyncEventQueues)
Registers the array of
AsyncEventQueues (AEQ) with this Region by appending to
the already existing, registered AEQs for this Region . |
void |
addGatewaySenders(org.apache.geode.cache.wan.GatewaySender[] gatewaySenders)
Registers the array of
GatewaySenders with this Region by appending to the already
existing, registered GatewaySenders for this Region . |
void |
addGatewaySendersIds(String[] gatewaySenderIds)
Registers the array of
GatewaySender IDs with this Region by appending to
the already existing, registered GatewaySenders for this Region . |
protected org.apache.geode.cache.RegionFactory<K,V> |
configure(org.apache.geode.cache.RegionFactory<K,V> regionFactory)
Configures the
RegionFactory based on the configuration settings of this PeerRegionFactoryBean . |
protected org.apache.geode.cache.Region<K,V> |
createRegion(org.apache.geode.cache.GemFireCache gemfireCache,
String regionName)
Creates a new
Region with the given name . |
protected org.apache.geode.cache.RegionFactory<K,V> |
createRegionFactory(org.apache.geode.cache.Cache cache)
Creates an instance of
RegionFactory with the given Cache which is then used to construct,
configure and initialize the Region specified by this PeerRegionFactoryBean . |
void |
destroy()
Closes and destroys this
Region . |
org.apache.geode.cache.RegionAttributes<K,V> |
getAttributes()
Returns the
RegionAttributes used to configure this Region . |
org.apache.geode.cache.DataPolicy |
getDataPolicy()
Returns resolved
DataPolicy as configured with the RegionFactory
when creating this Region . |
Boolean |
getOffHeap()
Returns a
Boolean value indicating whether off-heap memory was enabled for this Region . |
int |
getPhase() |
org.apache.geode.cache.Scope |
getScope()
Returns the configured
Scope of the Region affecting data distribution
and acknowledgement strategy (useful in consistency) for the Region . |
org.apache.geode.cache.RegionShortcut |
getShortcut()
Returns the configured
RegionShortcut . |
Boolean |
getStatisticsEnabled() |
boolean |
isAutoStartup() |
protected boolean |
isNotPersistent()
Returns true when the user explicitly specified a value for the persistent attribute and it is false.
|
boolean |
isOffHeap()
Returns a boolean value indicating whether off-heap memory use was enabled for this
Region . |
protected boolean |
isPersistent()
Returns true when the user explicitly specified a value for the persistent attribute and it is true.
|
boolean |
isRunning() |
boolean |
isStatisticsEnabled() |
protected <K,V> void |
mergePartitionAttributes(org.apache.geode.cache.RegionFactory<K,V> regionFactory,
org.apache.geode.cache.RegionAttributes<K,V> regionAttributes)
Merges the
RegionAttributes into the RegionFactory . |
protected <K,V> org.apache.geode.cache.RegionFactory<K,V> |
mergeRegionAttributes(org.apache.geode.cache.RegionFactory<K,V> regionFactory,
org.apache.geode.cache.RegionAttributes<K,V> regionAttributes)
Intelligently merges the given RegionAttributes with the configuration setting of the RegionFactory.
|
protected org.apache.geode.cache.RegionFactory<K,V> |
postProcess(org.apache.geode.cache.RegionFactory<K,V> regionFactory)
Post-process the
RegionFactory used to create the Region specified by
this PeerRegionFactoryBean during initialization. |
protected void |
resolveDataPolicy(org.apache.geode.cache.RegionFactory<K,V> regionFactory,
Boolean persistent,
org.apache.geode.cache.DataPolicy dataPolicy)
Validates and sets the Data Policy on the RegionFactory used to create and configure the Region from this
FactoryBean.
|
protected void |
resolveDataPolicy(org.apache.geode.cache.RegionFactory<K,V> regionFactory,
Boolean persistent,
String dataPolicy)
Validates the configured Data Policy and may override it, taking into account the 'persistent' attribute
and constraints for the Region type.
|
protected boolean |
resolveStatisticsEnabled() |
void |
setAsyncEventQueueIds(String[] asyncEventQueueIds)
|
void |
setAsyncEventQueues(org.apache.geode.cache.asyncqueue.AsyncEventQueue[] asyncEventQueues)
Configures an array of
AsyncEventQueues for this Region , which are used
to perform asynchronous data access operations, e.g. |
void |
setAttributes(org.apache.geode.cache.RegionAttributes<K,V> attributes)
Sets the
RegionAttributes used to configure this Region . |
void |
setCacheListeners(org.apache.geode.cache.CacheListener<K,V>[] cacheListeners)
Configures
CacheListeners used to listen for entry events on this Region . |
void |
setCacheLoader(org.apache.geode.cache.CacheLoader<K,V> cacheLoader)
Configures the
CacheLoader used by this Region to perform synchronous read-through
data access operations to an underlying, external data source. |
void |
setCacheWriter(org.apache.geode.cache.CacheWriter<K,V> cacheWriter)
Configures the
CacheWriter used by this Region to perform synchronous write-through
data access operations to an underlying, external data source. |
void |
setClose(boolean close)
Configure whether to close this Region during shutdown.
|
void |
setCompressor(org.apache.geode.compression.Compressor compressor)
Configures the
Compressor used to compress this Region's data. |
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)
Configure the
DataPolicy for this Region . |
void |
setDestroy(boolean destroy)
Configure whether to destroy this
Region during shutdown. |
void |
setDiskStoreName(String diskStoreName)
|
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 |
setGatewaySenderIds(String[] gatewaySenderIds)
Configures the
GatewaySenders by ID used to send data and events from
this Region to a matching Region in a remote cluster. |
void |
setGatewaySenders(org.apache.geode.cache.wan.GatewaySender[] gatewaySenders)
Configures the
GatewaySenders used to send data and events from this Region
to a matching Region in a remote cluster. |
void |
setKeyConstraint(Class<K> keyConstraint)
|
void |
setOffHeap(Boolean offHeap)
Configures this
Region with the capability to store data in off-heap memory. |
void |
setPersistent(Boolean persistent)
Configures whether to enable persistence for this
Region . |
void |
setRegionIdleTimeout(org.apache.geode.cache.ExpirationAttributes regionIdleTimeout) |
void |
setRegionTimeToLive(org.apache.geode.cache.ExpirationAttributes regionTimeToLive) |
void |
setScope(org.apache.geode.cache.Scope scope)
Configures the
Region's Scope , which affects data distribution
and acknowledgement strategy (useful in consistency) for the Region . |
void |
setShortcut(org.apache.geode.cache.RegionShortcut shortcut)
Configures the
Region with the given RegionShortcut . |
void |
setStatisticsEnabled(Boolean statisticsEnabled) |
void |
setValueConstraint(Class<V> valueConstraint)
|
void |
start() |
void |
stop() |
void |
stop(Runnable callback) |
applyRegionConfigurers, applyRegionConfigurers, applyRegionConfigurers, getCompositeRegionConfigurer, setRegionConfigurers, setRegionConfigurers
afterPropertiesSet, getCache, getLookupEnabled, getObject, getObjectType, getParent, getRegion, isLookupEnabled, loadSnapshot, postProcess, resolveRegionName, setCache, setLookupEnabled, setName, setParent, setRegion, setRegionName, setSnapshot
getBeanClassLoader, getBeanFactory, getBeanName, getLog, isSingleton, logDebug, logDebug, logError, logError, logInfo, logInfo, logWarning, logWarning, newLog, setBeanClassLoader, setBeanFactory, setBeanName
protected org.apache.geode.cache.Region<K,V> createRegion(org.apache.geode.cache.GemFireCache gemfireCache, String regionName)
Region
with the given name
.createRegion
in class ResolvableRegionFactoryBean<K,V>
gemfireCache
- reference to the GemFireCache
.regionName
- name
of the new Region
.Region
with the given name
.GemFireCache
,
Region
protected org.apache.geode.cache.RegionFactory<K,V> createRegionFactory(org.apache.geode.cache.Cache cache)
RegionFactory
with the given Cache
which is then used to construct,
configure and initialize the Region
specified by this PeerRegionFactoryBean
.cache
- reference to the Cache
.RegionFactory
used to construct, configure and initialized the Region
specified by
this PeerRegionFactoryBean
.Cache.createRegionFactory(org.apache.geode.cache.RegionShortcut)
,
Cache.createRegionFactory(org.apache.geode.cache.RegionAttributes)
,
Cache.createRegionFactory()
,
RegionFactory
protected org.apache.geode.cache.RegionFactory<K,V> configure(org.apache.geode.cache.RegionFactory<K,V> regionFactory)
RegionFactory
based on the configuration settings of this PeerRegionFactoryBean
.regionFactory
- RegionFactory
to configureRegionFactory
.RegionFactory
protected org.apache.geode.cache.RegionFactory<K,V> postProcess(org.apache.geode.cache.RegionFactory<K,V> regionFactory)
RegionFactory
used to create the Region
specified by
this PeerRegionFactoryBean
during initialization.
The RegionFactory
has been already constructed, configured and initialized by
this PeerRegionFactoryBean
before this method gets invoked.regionFactory
- RegionFactory
used to create the Region
.RegionFactory
.RegionFactory
protected <K,V> org.apache.geode.cache.RegionFactory<K,V> mergeRegionAttributes(org.apache.geode.cache.RegionFactory<K,V> regionFactory, org.apache.geode.cache.RegionAttributes<K,V> regionAttributes)
K
- the Class type fo the Region key.V
- the Class type of the Region value.regionFactory
- the GemFire RegionFactory used to configure and create the Region that is the product
of this PeerRegionFactoryBean.regionAttributes
- the RegionAttributes containing the Region configuration settings to merge to the
RegionFactory.isUserSpecifiedEvictionAttributes(org.apache.geode.cache.RegionAttributes)
,
validateRegionAttributes(org.apache.geode.cache.RegionAttributes)
,
RegionAttributes
,
RegionFactory
protected <K,V> void mergePartitionAttributes(org.apache.geode.cache.RegionFactory<K,V> regionFactory, org.apache.geode.cache.RegionAttributes<K,V> regionAttributes)
RegionAttributes
into the RegionFactory
.regionFactory
- RegionFactory
to configure.regionAttributes
- RegionAttributes
used to configure the RegionFactory
if not null.RegionAttributes
,
RegionFactory
protected boolean isNotPersistent()
isPersistent()
protected boolean isPersistent()
isNotPersistent()
protected void resolveDataPolicy(org.apache.geode.cache.RegionFactory<K,V> regionFactory, Boolean persistent, org.apache.geode.cache.DataPolicy dataPolicy)
regionFactory
- the RegionFactory used by this FactoryBean to create and configure the Region.persistent
- a boolean value indicating whether the Region should be persistent and persist it's
data to disk.dataPolicy
- the configured Data Policy for the Region.resolveDataPolicy(org.apache.geode.cache.RegionFactory, Boolean, String)
,
DataPolicy
,
RegionFactory
protected void resolveDataPolicy(org.apache.geode.cache.RegionFactory<K,V> regionFactory, Boolean persistent, String dataPolicy)
regionFactory
- the GemFire RegionFactory used to create the desired Region.persistent
- a boolean value indicating whether the Region should persist it's data to disk.dataPolicy
- requested Data Policy as set by the user in the Spring GemFire configuration meta-data.DataPolicy
,
RegionFactory
public void destroy() throws Exception
Region
.destroy
in interface DisposableBean
Exception
- if destroy()
fails.DisposableBean
,
Region.close()
,
Region.destroyRegion()
public void setAsyncEventQueues(@NonNull org.apache.geode.cache.asyncqueue.AsyncEventQueue[] asyncEventQueues)
AsyncEventQueues
for this Region
, which are used
to perform asynchronous data access operations, e.g. asynchronous, write-behind operations.
This method clears any existing, registered AsyncEventQueues
(AEQ) already associated
with this Region
. Use addAsyncEventQueues(AsyncEventQueue[])
or addAsyncEventQueueIds(String[])
to append to the existing AEQs already registered instead.asyncEventQueues
- array of AsyncEventQueues
registered with and used by
this Region
to perform asynchronous data access operations.AsyncEventQueue
,
addAsyncEventQueues(AsyncEventQueue[])
,
addAsyncEventQueueIds(String[])
,
setAsyncEventQueueIds(String[])
public void setAsyncEventQueueIds(@NonNull String[] asyncEventQueueIds)
AsyncEventQueues
(AEQ) for this Region
by AEQ ID
.
This method clears any existing, registered AsyncEventQueues
(AEQ) already associated
with this Region
by AEQ ID. Use addAsyncEventQueues(AsyncEventQueue[])
or addAsyncEventQueueIds(String[])
to append to the existing AEQs already registered instead.
or addAsyncEventQueueIds(String[])
to append to the existing AEQs already registered instead.asyncEventQueueIds
- array of Strings
specifying AEQ IDs
to be registered
with this Region
.addAsyncEventQueues(AsyncEventQueue[])
,
setAsyncEventQueues(AsyncEventQueue[])
,
setAsyncEventQueueIds(String[])
public void addAsyncEventQueues(@NonNull org.apache.geode.cache.asyncqueue.AsyncEventQueue[] asyncEventQueues)
AsyncEventQueues
(AEQ) with this Region
by appending to
the already existing, registered AEQs for this Region
.asyncEventQueues
- array of AsyncEventQueues
to register with this Region
.addAsyncEventQueueIds(String[])
,
setAsyncEventQueues(AsyncEventQueue[])
,
setAsyncEventQueueIds(String[])
public void addAsyncEventQueueIds(@NonNull String[] asyncEventQueueIds)
AsyncEventQueues
(AEQ) with this Region
by ID
by appending to the already existing, registered AEQs for this Region
.asyncEventQueueIds
- array of AsyncEventQueue
IDs
to register with
this Region
.addAsyncEventQueues(AsyncEventQueue[])
,
setAsyncEventQueues(AsyncEventQueue[])
,
setAsyncEventQueueIds(String[])
public void setAttributes(org.apache.geode.cache.RegionAttributes<K,V> attributes)
RegionAttributes
used to configure this Region
.
Specifying RegionAttributes
allows full control in configuring various Region
settings.
Used only when the Region
is created and not when the Region
is looked up.attributes
- RegionAttributes
used to configure this Region
.RegionAttributes
public org.apache.geode.cache.RegionAttributes<K,V> getAttributes()
RegionAttributes
used to configure this Region
.RegionAttributes
used to configure this Region
.RegionAttributes
public void setCacheListeners(org.apache.geode.cache.CacheListener<K,V>[] cacheListeners)
CacheListeners
used to listen for entry events on this Region
.
Used only when a new Region
is created and not looked up
.
Overrides the Region
settings specified in RegionAttributes
set with setAttributes(RegionAttributes)
.cacheListeners
- array CacheListeners
to register with this Region
.CacheListener
public void setCacheLoader(org.apache.geode.cache.CacheLoader<K,V> cacheLoader)
CacheLoader
used by this Region
to perform synchronous read-through
data access operations to an underlying, external data source.
Used only when a new Region
is created and not looked up
.
Overrides the Region
settings specified in RegionAttributes
set with setAttributes(RegionAttributes)
.cacheLoader
- CacheLoader
to register for this Region
.CacheLoader
public void setCacheWriter(org.apache.geode.cache.CacheWriter<K,V> cacheWriter)
CacheWriter
used by this Region
to perform synchronous write-through
data access operations to an underlying, external data source.
Used only when a new Region
is created and not looked up
.
Overrides the Region
settings specified in RegionAttributes
set with setAttributes(RegionAttributes)
.cacheWriter
- CacheWriter
to register for this Region
.CacheWriter
public void setClose(boolean close)
close
- boolean value indicating whether this Region
should be closed during shutdown.setDestroy(boolean)
public void setCompressor(org.apache.geode.compression.Compressor compressor)
Compressor
used to compress this Region's
data.compressor
- Compressor
used to compress this Region's
data.Compressor
public void setCustomEntryIdleTimeout(org.apache.geode.cache.CustomExpiry<K,V> customEntryIdleTimeout)
setCustomEntryIdleTimeout
in interface ExpiringRegionFactoryBean<K,V>
public void setCustomEntryTimeToLive(org.apache.geode.cache.CustomExpiry<K,V> customEntryTimeToLive)
setCustomEntryTimeToLive
in interface ExpiringRegionFactoryBean<K,V>
public void setDestroy(boolean destroy)
Region
during shutdown.
Defaults to false.destroy
- value indicating whether this Region
should be destroyed during shutdown.setClose(boolean)
public void setDataPolicy(org.apache.geode.cache.DataPolicy dataPolicy)
DataPolicy
for this Region
.dataPolicy
- DataPolicy
used when configuring this Region
.DataPolicy
public org.apache.geode.cache.DataPolicy getDataPolicy()
DataPolicy
as configured with the RegionFactory
when creating this Region
.DataPolicy
used by this Region
.IllegalStateException
- if the DataPolicy
has not been configured
or is not resolvable.DataPolicy
public void setDiskStoreName(String diskStoreName)
diskStoreName
- String
containing the name of the DiskStore
bean
configured for this Region
.public void setEntryIdleTimeout(org.apache.geode.cache.ExpirationAttributes entryIdleTimeout)
setEntryIdleTimeout
in interface ExpiringRegionFactoryBean<K,V>
public void setEntryTimeToLive(org.apache.geode.cache.ExpirationAttributes entryTimeToLive)
setEntryTimeToLive
in interface ExpiringRegionFactoryBean<K,V>
public void setEvictionAttributes(org.apache.geode.cache.EvictionAttributes evictionAttributes)
setEvictionAttributes
in interface EvictingRegionFactoryBean
public void setGatewaySenders(@NonNull org.apache.geode.cache.wan.GatewaySender[] gatewaySenders)
GatewaySenders
used to send data and events from this Region
to a matching Region
in a remote cluster.
This method clears all existing, registered GatewaySenders
already associated with
this Region
. Use addGatewaySenders(GatewaySender[])
or addGatewaySendersIds(String[])
to append to the existing, registered
GatewaySenders
for this Region
.gatewaySenders
- GatewaySenders
used to send data and events from this Region
to a matching Region
in a remote cluster.GatewaySender
,
addGatewaySenders(GatewaySender[])
,
addGatewaySendersIds(String[])
,
setGatewaySenderIds(String[])
public void setGatewaySenderIds(@NonNull String[] gatewaySenderIds)
GatewaySenders
by ID
used to send data and events from
this Region
to a matching Region
in a remote cluster.
This method clears all existing, registered GatewaySenders
already associated with
this Region
. Use addGatewaySenders(GatewaySender[])
or addGatewaySendersIds(String[])
to append to the existing, registered
GatewaySenders
for this Region
.gatewaySenderIds
- String
array containing GatewaySender
IDs
to register
with this Region
.addGatewaySenders(GatewaySender[])
,
addGatewaySendersIds(String[])
,
setGatewaySenders(GatewaySender[])
public void addGatewaySenders(@NonNull org.apache.geode.cache.wan.GatewaySender[] gatewaySenders)
GatewaySenders
with this Region
by appending to the already
existing, registered GatewaySenders
for this Region
.gatewaySenders
- array of GatewaySenders
to register with this Region
.GatewaySender
,
addGatewaySendersIds(String[])
,
setGatewaySenders(GatewaySender[])
,
setGatewaySenderIds(String[])
public void addGatewaySendersIds(@NonNull String[] gatewaySenderIds)
GatewaySender
IDs
with this Region
by appending to
the already existing, registered GatewaySenders
for this Region
.gatewaySenderIds
- array of GatewaySender
IDs
to register with this Region
.GatewaySender
,
addGatewaySenders(GatewaySender[])
,
setGatewaySenders(GatewaySender[])
,
setGatewaySenderIds(String[])
public void setOffHeap(Boolean offHeap)
Region
with the capability to store data in off-heap memory.offHeap
- Boolean
value indicating whether to enable the use of off-heap memory
for this Region
.RegionFactory.setOffHeap(boolean)
public Boolean getOffHeap()
Boolean
value indicating whether off-heap memory was enabled for this Region
.
Off-heap memory will be enabled for this Region
if this method returns a non-null,
Boolean
value evaluating to true.Boolean
value indicating whether off-heap memory use is enabled for
this Region
.public boolean isOffHeap()
Region
.Region
.getOffHeap()
public void setPersistent(Boolean persistent)
Region
.
When persistence is enable, then data in the Region
is persisted to disk
using the configured, specified DiskStore
, or the DEFAULT DiskStore
if a DiskStore
was not explicitly configured.persistent
- Boolean
value indicating whether to enaable persistence
for this Region
.public void setRegionIdleTimeout(org.apache.geode.cache.ExpirationAttributes regionIdleTimeout)
setRegionIdleTimeout
in interface ExpiringRegionFactoryBean<K,V>
public void setRegionTimeToLive(org.apache.geode.cache.ExpirationAttributes regionTimeToLive)
setRegionTimeToLive
in interface ExpiringRegionFactoryBean<K,V>
public void setScope(org.apache.geode.cache.Scope scope)
Region's
Scope
, which affects data distribution
and acknowledgement strategy (useful in consistency) for the Region
.scope
- Scope
used to configure the Region's
data distribution
and acknowledgement strategy.Scope
public org.apache.geode.cache.Scope getScope()
Scope
of the Region
affecting data distribution
and acknowledgement strategy (useful in consistency) for the Region
.Scope
of the Region
.Scope
public void setShortcut(org.apache.geode.cache.RegionShortcut shortcut)
Region
with the given RegionShortcut
.shortcut
- RegionShortcut
used to configure pre-defined defaults for the Region
.RegionShortcut
public org.apache.geode.cache.RegionShortcut getShortcut()
RegionShortcut
.RegionShortcut
.RegionShortcut
public void setStatisticsEnabled(Boolean statisticsEnabled)
public Boolean getStatisticsEnabled()
public boolean isStatisticsEnabled()
protected boolean resolveStatisticsEnabled()
public void stop(Runnable callback)
stop
in interface SmartLifecycle
public int getPhase()
getPhase
in interface Phased
getPhase
in interface SmartLifecycle
public boolean isAutoStartup()
isAutoStartup
in interface SmartLifecycle
Copyright © 2011–2021 Pivotal Software, Inc.. All rights reserved.