Class DataPolicy

java.lang.Object
org.apache.geode.cache.DataPolicy
All Implemented Interfaces:
Serializable

@Immutable public class DataPolicy extends Object implements Serializable
Enumerated type for region data policy. The data policy specifies how this local cache will handle the data for a region.
  1. EMPTY causes data to never be stored in local memory. The region will always appear empty. It can be used to for zero footprint producers that only want to distribute their data to others and for zero footprint consumers that only want to see events.
  2. NORMAL causes data that this region is interested in to be stored in local memory. It allows the contents in this cache to differ from other caches.
  3. PARTITION causes data that this region holds to be spread across processes. The amount of data held in this cache is configured in PartitionAttributes with a PartitionAttributesFactory.
  4. PERSISTENT_PARTITION in addition to PARTITION also causes data to be stored to disk. The region initialization uses the data stored on disk.
  5. REPLICATE causes data that this region is interested in to be stored in local memory. A distributed region will be initialized with the data from other caches. On distributed region operations that would cause the contents to differ with other caches are not allowed. This policy is allowed on local scope region but it behaves the same as NORMAL.
  6. PERSISTENT_REPLICATE in addition to REPLICATE also causes data to be stored to disk. The region initialization uses the data stored on disk. Note that the persistence applies to both local scope and distributed scope.
Since:
GemFire 5.0
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final DataPolicy
    The data policy used by default; it is NORMAL.
    static final DataPolicy
    Data is never stored in local memory.
    static final DataPolicy
    Allows the contents in this cache to differ from other caches.
    final byte
    Deprecated.
    static final DataPolicy
    Data in this region may be spread across a number of processes.
    static final DataPolicy
    In addition to PARTITION also causes data to be stored to disk.
    static final DataPolicy
    In addition to REPLICATE also causes data to be stored to disk.
    static final DataPolicy
    In addition to NORMAL, contents inside of this cache are (partially) initialized with data from other caches, if available.
    static final DataPolicy
    The region will be initialized with the data from other caches and accepts any new entries created in other caches.
  • Method Summary

    Modifier and Type
    Method
    Description
    static DataPolicy
    fromOrdinal(byte ordinal)
    Return the DataPolicy represented by specified ordinal
    static DataPolicy
    Deprecated.
    boolean
    Deprecated.
    from version 6.5 forward please use an identity comparison instead of this method
    boolean
    Deprecated.
    from version 6.5 forward please use withStorage()
    boolean
    Deprecated.
    from version 6.5 forward please use an identity comparison instead of this method
    boolean
    Deprecated.
    from version 6.5 forward please use withPartitioning()
    boolean
    Deprecated.
    from version 6.5 forward please use withPersistence() and withReplication()
    boolean
    Deprecated.
    from version 6.5 forward please use withPreloaded()
    boolean
    Deprecated.
    from version 6.5 forward please use withReplication()
    int
     
    Returns a string representation for this data policy.
    static DataPolicy
    Get enum value by name.
    boolean
    Return whether this policy does partitioning.
    boolean
    Return whether this policy does persistence.
    boolean
    Return whether this policy does preloaded.
    boolean
    Return whether this policy does replication.
    boolean
    Return true if regions with this policy store data locally.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • EMPTY

      @Immutable public static final DataPolicy EMPTY
      Data is never stored in local memory. The region will always be empty locally. It can be used to for zero footprint producers that only want to distribute their data to others and for zero footprint consumers that only want to see events.
    • NORMAL

      @Immutable public static final DataPolicy NORMAL
      Allows the contents in this cache to differ from other caches.

      Data that this region is interested in is stored in local memory.

    • REPLICATE

      @Immutable public static final DataPolicy REPLICATE
      The region will be initialized with the data from other caches and accepts any new entries created in other caches.

      Operations that would cause the contents to differ with other caches are not allowed.

      Data that this region is interested in is stored in local memory.

    • PERSISTENT_REPLICATE

      @Immutable public static final DataPolicy PERSISTENT_REPLICATE
      In addition to REPLICATE also causes data to be stored to disk. The region initialization may use the data stored on disk.
    • PARTITION

      @Immutable public static final DataPolicy PARTITION
      Data in this region may be spread across a number of processes. This is further configured with partitioning attributes
    • PRELOADED

      @Immutable public static final DataPolicy PRELOADED
      In addition to NORMAL, contents inside of this cache are (partially) initialized with data from other caches, if available.
    • PERSISTENT_PARTITION

      @Immutable public static final DataPolicy PERSISTENT_PARTITION
      In addition to PARTITION also causes data to be stored to disk. The region initialization may use the data stored on disk.
      Since:
      GemFire 6.5
    • DEFAULT

      @Immutable public static final DataPolicy DEFAULT
      The data policy used by default; it is NORMAL.
    • ordinal

      @Deprecated public final byte ordinal
      Deprecated.
      Used as ordinal to represent this DataPolicy
  • Method Details

    • ordinal

      public int ordinal()
      Returns:
      ordinal value.
    • valueOf

      public static DataPolicy valueOf(String name) throws IllegalArgumentException
      Get enum value by name.
      Parameters:
      name - of enum value.
      Returns:
      enum by name.
      Throws:
      IllegalArgumentException - if the specified enum type has no constant with the specified name.
      NullPointerException - if name is null.
    • fromOrdinal

      public static DataPolicy fromOrdinal(byte ordinal)
      Return the DataPolicy represented by specified ordinal
      Parameters:
      ordinal - the ordinal representation of a DataPolicy
      Returns:
      the DataPolicy represented by specified ordinal
    • withStorage

      public boolean withStorage()
      Return true if regions with this policy store data locally.

      Although DataPolicy PARTITION will return true to this query, it is possible to turn off local storage with PartitionAttributesFactory.setLocalMaxMemory(int) by setting localMaxMemory to zero.

      Returns:
      true if regions with this policy store data locally.
      See Also:
    • withReplication

      public boolean withReplication()
      Return whether this policy does replication.
      Returns:
      true if this policy does replication.
      See Also:
    • withPersistence

      public boolean withPersistence()
      Return whether this policy does persistence.
      Returns:
      true if this policy does persistence.
      Since:
      GemFire 6.5
      See Also:
    • withPartitioning

      public boolean withPartitioning()
      Return whether this policy does partitioning.
      Returns:
      true if this policy does partitioning
      Since:
      GemFire 6.5
      See Also:
    • withPreloaded

      public boolean withPreloaded()
      Return whether this policy does preloaded.
      Returns:
      true if this policy does preloaded.
      Since:
      GemFire 6.5
      See Also:
    • isEmpty

      @Deprecated public boolean isEmpty()
      Deprecated.
      from version 6.5 forward please use withStorage()
      Return true if this policy is EMPTY.
      Returns:
      true if this policy is EMPTY.
    • isNormal

      @Deprecated public boolean isNormal()
      Deprecated.
      from version 6.5 forward please use an identity comparison instead of this method
      Return true if this policy is NORMAL.
      Returns:
      true if this policy is NORMAL.
    • isPreloaded

      @Deprecated public boolean isPreloaded()
      Deprecated.
      from version 6.5 forward please use withPreloaded()
      Return true if this policy is PRELOADED.
      Returns:
      true if this policy is PRELOADED
    • isDefault

      @Deprecated public boolean isDefault()
      Deprecated.
      from version 6.5 forward please use an identity comparison instead of this method
      Return true if this policy is the default.
      Returns:
      true if this policy is the default.
    • isReplicate

      @Deprecated public boolean isReplicate()
      Deprecated.
      from version 6.5 forward please use withReplication()
      Return true if this policy is REPLICATE.
      Returns:
      true if this policy is REPLICATE.
    • isPersistentReplicate

      @Deprecated public boolean isPersistentReplicate()
      Deprecated.
      from version 6.5 forward please use withPersistence() and withReplication()
      Return true if this policy is PERSISTENT_REPLICATE.
      Returns:
      true if this policy is PERSISTENT_REPLICATE.
    • isPartition

      @Deprecated public boolean isPartition()
      Deprecated.
      from version 6.5 forward please use withPartitioning()
      Return true if this policy is PARTITION.
      Returns:
      true if this policy is PARTITION
    • toString

      public String toString()
      Returns a string representation for this data policy.
      Overrides:
      toString in class Object
      Returns:
      the name of this data policy.
    • fromString

      @Deprecated public static DataPolicy fromString(String s)
      Deprecated.
      Parameters:
      s - a String representation of a DataPolicy
      Returns:
      a DataPolicy