InterestPolicy (Apache Geode 1.13.0)
Date: 2020-09-07

org.apache.geode.cache

## Class InterestPolicy

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

- All Implemented Interfaces:
    Serializable

      @Immutable
      public class InterestPolicy
      extends Object
      implements Serializable

  Enumerated type for region subscription interest policy. The interest policy specifies what data a subscriber is interested in having in it's region.
  Since:
    GemFire 5.0
  See Also:
    `SubscriptionAttributes`, Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static InterestPolicy` | `ALL` This subscriber is interested in all data.
    `static InterestPolicy` | `CACHE_CONTENT` This subscriber is interested in data that is already in its cache.
    `static InterestPolicy` | `DEFAULT` The interest policy used by default; it is `CACHE_CONTENT`.
    `byte` | `ordinal` used as ordinal to represent this InterestPolicy

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static InterestPolicy` | `fromOrdinal(byte ordinal)` Return the InterestPolicy represented by specified ordinal
    `boolean` | `isAll()` Return true if this policy is `ALL`.
    `boolean` | `isCacheContent()` Return true if this policy is `CACHE_CONTENT`.
    `boolean` | `isDefault()` Return true if this policy is the default.
    `String` | `toString()` Returns a string representation for this interest policy.

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

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

- - ### Field Detail

    - #### ALL

          @Immutable
          public static final InterestPolicy ALL

      This subscriber is interested in all data. More specifically operations done in this cache and distributed operations done in remote caches.

      When combined with `DataPolicy.EMPTY` this region will receive events for every distributed operation but will not store the data.

      When combined with `DataPolicy.NORMAL` or `DataPolicy.PRELOADED` this region will accept `Region.create(Object, Object)` operations done remotely. Without the `ALL` interest policy, `NORMAL` and `PRELOADED` ignore `creates` that the region does not have an existing entry for.

      When combined with the `replication policies` this interest has no effect.

      When combined with `DataPolicy.PARTITION` this interest policy causes cache listeners to be notified of changes regardless of the physical location of the data affected. That is, a listener in a VM using this policy will receive notification of all changes to the partitioned region.

    - #### CACHE_CONTENT

          @Immutable
          public static final InterestPolicy CACHE_CONTENT

      This subscriber is interested in data that is already in its cache. More specifically operations done in this cache and distributed operations done in remote caches.

      When combined with `DataPolicy.EMPTY` this region will never receive events for distributed operations since its content is always empty. It will continue to get events for operations done locally.

      When combined with `DataPolicy.NORMAL` or `DataPolicy.PRELOADED` this region will accept remote operations done to entries it already has in its cache.

      When combined with the `replication policies` * this interest has no effect.

      When combined with `DataPolicy.PARTITION` this interest policy causes cache listeners to be notified in the VM holding the affected data. That is, listeners are only notified if the affected* key-value pair is in the same process as the listener.

    - #### DEFAULT

          @Immutable
          public static final InterestPolicy DEFAULT

      The interest policy used by default; it is `CACHE_CONTENT`.

    - #### ordinal

          public final byte ordinal

      used as ordinal to represent this InterestPolicy

  - ### Method Detail

    - #### fromOrdinal

          public static InterestPolicy fromOrdinal(byte ordinal)

      Return the InterestPolicy represented by specified ordinal

    - #### isAll

          public boolean isAll()

      Return true if this policy is `ALL`.
      Returns:
        true if this policy is `ALL`.

    - #### isCacheContent

          public boolean isCacheContent()

      Return true if this policy is `CACHE_CONTENT`.
      Returns:
        true if this policy is `CACHE_CONTENT`.

    - #### isDefault

          public boolean isDefault()

      Return true if this policy is the default.
      Returns:
        true if this policy is the default.

    - #### toString

          public String toString()

      Returns a string representation for this interest policy.
      Overrides:
        `toString` in class `Object`
      Returns:
        the name of this interest policy.