Class DynamicRegionFactory
Instructions for Use:
- If your application is a client in a client/server installation, either specify the pool name
in the
DynamicRegionFactory.Configyou'll use to create a DynamicRegionFactory or specify it in a dynamic-region-factory element in your cache.xml. - Before you've created a GemFire Cache in your application, add a line of code as follows:
{ DynamicRegionFactory factory = DynamicRegionFactory.get(); factory.open(config); }{ DynamicRegionFactory myFactoryHandle = DynamicRegionFactory.get().open(config); }or just use a dynamic-region-factory element in the cache.xml. - Create the GemFire Cache. During cache creation, the list of dynamic Regions will either be
discovered by recovering their names from disk (see
DynamicRegionFactory.Config.persistBackup) or from other members of the distributed system. These dynamic Regions will be created before Cache creation completes. - Thereafter, when you want to create dynamic distributed Regions, create them using the
createDynamicRegion(java.lang.String, java.lang.String). Regions created with the factory will inherit their RegionAttributes from their parent Region, though you can override callbacks when you configure the factory.All other instances of GemFire across the distributed system that instantiate and open a DynamicRegionFactory will also get the dynamic distributed Regions.
- Non-dynamic parent Regions should be declared in cache.xml so that they can be created before the dynamic Region factory goes active and starts creating Regions. You will have cache creation problems if this isn't done.
- A DynamicRegionListener can be registered before open is called and before cache creation so that the listener will be called if dynamic Regions are created during cache creation.
Saving the factory on disk: If DynamicRegionFactory.Config.persistBackup is configured
for the factory, dynamic Region information is written to disk for recovery. By default the
current directory is used for this information. The DynamicRegionFactory.Config.diskDir
can be used to change this default.
Registering interest in cache server information: The
DynamicRegionFactory.Config.registerInterest setting determines whether clients will
register interest in server keys or not. You will generally want this to be turned on so that
clients will see updates made to servers. In server processes, DynamicRegionFactory forces use of
NotifyBySubscription.
Notes:
- DynamicRegionFactories in non-client VMs must not be configured with a pool.
- If
open()is called before cache creation and the cache.xml has a dynamic-region-factory element then the cache.xml will override the open call's configuration. - Since the RegionAttributes of a dynamically created Region are copied from the parent Region,
any callbacks, (
CacheListener,CacheWriter, andCacheLoaderare shared by the parent and all its dynamic children so make sure the callback is thread-safe and that itsCacheCallback.close()implementation does not stop it from functioning. However the products EvictionAlgorithm instances will be cloned so that each dynamic Region has its own callback. - The root Region name "DynamicRegions" is reserved. The factory creates a root Region of that name and uses it to keep track of what dynamic Regions exist. Applications should not directly access this Region; instead use the methods on this factory.
- Since:
- GemFire 4.3
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classDeprecated.Configuration for dynamic region factory. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidbuildDynamicRegion(EntryEvent event) Deprecated.createDynamicRegion(String parentRegionName, String regionName) Deprecated.Creates the dynamic Region in the local cache and distributes the creation to other caches.voiddestroyDynamicRegion(String fullRegionName) Deprecated.Destroys the dynamic Region in the local cache and distributes the destruction to other caches.protected voiddoClose()Deprecated.Closes the dynamic region factory, disabling any further creation or destruction of dynamic regions in this cache.protected voiddoInternalInit(org.apache.geode.internal.cache.InternalCache theCache) Deprecated.The method is for internal use only.static DynamicRegionFactoryget()Deprecated.Returns theDynamicRegionFactorysingleton instance.Deprecated.Returns the configuration for this factory.booleanisActive()Deprecated.Returns true if this factory is open and can produce dynamic regions.booleanisClosed()Deprecated.Returns true if dynamic region factory is closed.booleanisOpen()Deprecated.Returns true if dynamic region factory is open; false if closed.voidopen()Deprecated.Opens the DynamicRegionFactory with default settings.voidDeprecated.Opens the factory with the given settings.protected voidrazeDynamicRegion(EntryEvent event) Deprecated.static booleanregionIsDynamicRegionList(String regionPath) Deprecated.voidDeprecated.Registers aDynamicRegionListenerfor callbacks.voidDeprecated.Unregisters aDynamicRegionListenerfor callbacks.
-
Field Details
-
DYNAMIC_REGION_LIST_NAME
Deprecated.- See Also:
-
-
Constructor Details
-
DynamicRegionFactory
public DynamicRegionFactory()Deprecated.
-
-
Method Details
-
open
public void open()Deprecated.Opens the DynamicRegionFactory with default settings. -
open
Deprecated.Opens the factory with the given settings. This should be sent to the factory before creating a cache. The cache will otherwise open a factory with default settings. This does not need to be sent if the cache.xml declares the use of dynamic regions.- Parameters:
conf- the configuration for this factory.
-
doClose
protected void doClose()Deprecated.Closes the dynamic region factory, disabling any further creation or destruction of dynamic regions in this cache. -
isOpen
public boolean isOpen()Deprecated.Returns true if dynamic region factory is open; false if closed.- Returns:
- whether this dynamic region factory is open
-
isActive
public boolean isActive()Deprecated.Returns true if this factory is open and can produce dynamic regions. Factories are only active after their cache has been created.- Returns:
- whether this factory is open and can produce dynamic regions
-
isClosed
public boolean isClosed()Deprecated.Returns true if dynamic region factory is closed.- Returns:
- whether the dynamic region factory is closed
-
getConfig
Deprecated.Returns the configuration for this factory. Returns null if the factory is closed;- Returns:
- the configuration for this factory
-
regionIsDynamicRegionList
Deprecated. -
doInternalInit
protected void doInternalInit(org.apache.geode.internal.cache.InternalCache theCache) throws CacheException Deprecated.The method is for internal use only. It is called implicitly during cache creation.This method is called internally during cache initialization at the correct time. Initialize the factory with a GemFire Cache. We create the metadata Region which holds all our dynamically created regions.
- Parameters:
theCache- The GemFireCache- Throws:
CacheException
-
get
Deprecated.Returns theDynamicRegionFactorysingleton instance.- Returns:
- the
DynamicRegionFactorysingleton instance
-
registerDynamicRegionListener
Deprecated.Registers aDynamicRegionListenerfor callbacks.- Parameters:
listener- TheDynamicRegionListenerto be registered
-
unregisterDynamicRegionListener
Deprecated.Unregisters aDynamicRegionListenerfor callbacks.- Parameters:
listener- TheDynamicRegionListenerto be unregistered
-
createDynamicRegion
Deprecated.Creates the dynamic Region in the local cache and distributes the creation to other caches.- Parameters:
parentRegionName- the new region is created as a subregion of the region having this pathregionName- the name of the new subregion- Returns:
- the
Regioncreated - Throws:
CacheException
-
destroyDynamicRegion
Deprecated.Destroys the dynamic Region in the local cache and distributes the destruction to other caches.- Parameters:
fullRegionName- The full path of theRegionto be dynamically destroyed- Throws:
RegionDestroyedException- if the dynamic region was never created or has already been destroyedCacheException
-
buildDynamicRegion
Deprecated. -
razeDynamicRegion
Deprecated.
-
FunctionServiceto create regions on other members instead.