DynamicRegionFactory (Apache Geode 1.15.4)

org.apache.geode.cache

## Class DynamicRegionFactory

- java.lang.Object
- - org.apache.geode.cache.DynamicRegionFactory

- Deprecated.
  This class is deprecated. Use `FunctionService` to create regions on other members instead.

      @Deprecated
      public abstract class DynamicRegionFactory
      extends Object

  DynamicRegionFactory provides a distributed region creation service. Any other member of the GemFire DistributedSystem that has created an instance of this class will automatically instantiate regions created through the factory from anywhere else in the DistributedSystem.

  Instructions for Use:

  - If your application is a client in a client/server installation, either specify the pool name in the `DynamicRegionFactory.Config` you'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`, and `CacheLoader` are shared by the parent and all its dynamic children so make sure the callback is thread-safe and that its `CacheCallback.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 Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `DynamicRegionFactory.Config` Deprecated. Configuration for dynamic region factory.

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `DYNAMIC_REGION_LIST_NAME` Deprecated.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DynamicRegionFactory()` Deprecated.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `buildDynamicRegion(EntryEvent event)` Deprecated.
    `Region` | `createDynamicRegion(String parentRegionName, String regionName)` Deprecated. Creates the dynamic Region in the local cache and distributes the creation to other caches.
    `void` | `destroyDynamicRegion(String fullRegionName)` Deprecated. Destroys the dynamic Region in the local cache and distributes the destruction to other caches.
    `protected void` | `doClose()` Deprecated. Closes the dynamic region factory, disabling any further creation or destruction of dynamic regions in this cache.
    `protected void` | `doInternalInit(org.apache.geode.internal.cache.InternalCache theCache)` Deprecated. The method is for internal use only.
    `static DynamicRegionFactory` | `get()` Deprecated. Returns the `DynamicRegionFactory` singleton instance.
    `DynamicRegionFactory.Config` | `getConfig()` Deprecated. Returns the configuration for this factory.
    `boolean` | `isActive()` Deprecated. Returns true if this factory is open and can produce dynamic regions.
    `boolean` | `isClosed()` Deprecated. Returns true if dynamic region factory is closed.
    `boolean` | `isOpen()` Deprecated. Returns true if dynamic region factory is open; false if closed.
    `void` | `open()` Deprecated. Opens the DynamicRegionFactory with default settings.
    `void` | `open(DynamicRegionFactory.Config conf)` Deprecated. Opens the factory with the given settings.
    `protected void` | `razeDynamicRegion(EntryEvent event)` Deprecated.
    `static boolean` | `regionIsDynamicRegionList(String regionPath)` Deprecated.
    `void` | `registerDynamicRegionListener(DynamicRegionListener listener)` Deprecated. Registers a `DynamicRegionListener` for callbacks.
    `void` | `unregisterDynamicRegionListener(DynamicRegionListener listener)` Deprecated. Unregisters a `DynamicRegionListener` for callbacks.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### DYNAMIC_REGION_LIST_NAME

          public static final String DYNAMIC_REGION_LIST_NAME

      Deprecated.
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### DynamicRegionFactory

          public DynamicRegionFactory()

      Deprecated.

  - ### Method Detail

    - #### open

          public void open()

      Deprecated.
      Opens the DynamicRegionFactory with default settings.

    - #### open

          public void open(DynamicRegionFactory.Config conf)

      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

          public DynamicRegionFactory.Config getConfig()

      Deprecated.
      Returns the configuration for this factory. Returns null if the factory is closed;
      Returns:
        the configuration for this factory

    - #### regionIsDynamicRegionList

          public static boolean regionIsDynamicRegionList(String regionPath)

      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 GemFire `Cache`
      Throws:
        `CacheException`

    - #### get

          public static DynamicRegionFactory get()

      Deprecated.
      Returns the `DynamicRegionFactory` singleton instance.
      Returns:
        the `DynamicRegionFactory` singleton instance

    - #### registerDynamicRegionListener

          public void registerDynamicRegionListener(DynamicRegionListener listener)

      Deprecated.
      Registers a `DynamicRegionListener` for callbacks.
      Parameters:
        `listener` - The `DynamicRegionListener` to be registered

    - #### unregisterDynamicRegionListener

          public void unregisterDynamicRegionListener(DynamicRegionListener listener)

      Deprecated.
      Unregisters a `DynamicRegionListener` for callbacks.
      Parameters:
        `listener` - The `DynamicRegionListener` to be unregistered

    - #### createDynamicRegion

          public Region createDynamicRegion(String parentRegionName,
                                            String regionName)
                                     throws CacheException

      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 path
        `regionName` - the name of the new subregion
      Returns:
        the `Region` created
      Throws:
        `CacheException`

    - #### destroyDynamicRegion

          public void destroyDynamicRegion(String fullRegionName)
                                    throws CacheException

      Deprecated.
      Destroys the dynamic Region in the local cache and distributes the destruction to other caches.
      Parameters:
        `fullRegionName` - The full path of the `Region` to be dynamically destroyed
      Throws:
        `RegionDestroyedException` - if the dynamic region was never created or has already been destroyed
        `CacheException`

    - #### buildDynamicRegion

          protected void buildDynamicRegion(EntryEvent event)

      Deprecated.

    - #### razeDynamicRegion

          protected void razeDynamicRegion(EntryEvent event)

      Deprecated.