org.apache.geode.cache

## Class Operation

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

- All Implemented Interfaces:
    java.io.Serializable

      public final class Operation
      extends java.lang.Object
      implements java.io.Serializable

  Enumerated type for an event operation. This class describes the operation that generated the event.
  Since:
    GemFire 5.0
  See Also:
    `CacheEvent.getOperation()`, Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static Operation` | `CACHE_CLOSE` A cache close.
    `static Operation` | `CACHE_CREATE` A cache create.
    `static Operation` | `CACHE_RECONNECT` A cache close triggered by `LossAction.RECONNECT`.
    `static Operation` | `CONTAINS_KEY` A 'check for existence of key' operation.
    `static Operation` | `CONTAINS_VALUE` A 'check for existence of value' operation.
    `static Operation` | `CONTAINS_VALUE_FOR_KEY` A 'check for existence of value for given key' operation.
    `static Operation` | `CREATE` An entry creation.
    `static Operation` | `DESTROY` An entry distributed destroy.
    `static Operation` | `EVICT_DESTROY` An entry local destroy caused by an eviction.
    `static Operation` | `EXPIRE_DESTROY` An entry distributed destroy triggered by expiration
    `static Operation` | `EXPIRE_INVALIDATE` An entry distributed invalidate triggered by expiration
    `static Operation` | `EXPIRE_LOCAL_DESTROY` An entry local destroy triggered by expiration
    `static Operation` | `EXPIRE_LOCAL_INVALIDATE` An entry local invalidate triggered by expiration
    `static Operation` | `FORCED_DISCONNECT` A cache close due to being forced out of the distributed system by other members.
    `static Operation` | `FUNCTION_EXECUTION` A 'function execution' operation.
    `static Operation` | `GET` A 'value for key' operation.
    `static Operation` | `GET_ENTRY` A 'entry for key' operation.
    `static Operation` | `GET_FOR_REGISTER_INTEREST` A 'get for register interest' operation.
    `static Operation` | `INVALIDATE` An entry distributed invalidate.
    `static Operation` | `LOCAL_DESTROY` An entry local destroy.
    `static Operation` | `LOCAL_INVALIDATE` An entry local invalidate.
    `static Operation` | `LOCAL_LOAD_CREATE` An entry creation caused by a local loader
    `static Operation` | `LOCAL_LOAD_UPDATE` An entry update caused by a local load.
    `static Operation` | `MARKER` A marker operation.
    `static Operation` | `NET_LOAD_CREATE` An entry creation caused by a net loader
    `static Operation` | `NET_LOAD_UPDATE` An entry update caused by a net load.
    `byte` | `ordinal` byte used as ordinal to represent this Operation
    `static Operation` | `PUT_IF_ABSENT` An atomic entry creation operation
    `static Operation` | `PUTALL_CREATE` An entry creation caused by a putAll invocation
    `static Operation` | `PUTALL_UPDATE` An entry update caused by a putAll invocation.
    `static Operation` | `REGION_CLEAR` A region clear.
    `static Operation` | `REGION_CLOSE` A region close
    `static Operation` | `REGION_CREATE` A region create.
    `static Operation` | `REGION_DESTROY` A region distributed destroy.
    `static Operation` | `REGION_EXPIRE_DESTROY` A region distributed destroy triggered by expiration
    `static Operation` | `REGION_EXPIRE_INVALIDATE` A region distributed invalidate triggered by expiration
    `static Operation` | `REGION_EXPIRE_LOCAL_DESTROY` A region local destroy triggered by expiration
    `static Operation` | `REGION_EXPIRE_LOCAL_INVALIDATE` A region local invalidate triggered by expiration
    `static Operation` | `REGION_INVALIDATE` A region distributed invalidate.
    `static Operation` | `REGION_LOAD_SNAPSHOT` A region load snapshot.
    `static Operation` | `REGION_LOCAL_CLEAR` A region local clear.
    `static Operation` | `REGION_LOCAL_DESTROY` A region local destroy.
    `static Operation` | `REGION_LOCAL_INVALIDATE` A region local invalidate.
    `static Operation` | `REGION_REINITIALIZE` A region destroy triggered by `ResumptionAction.REINITIALIZE`.
    `static Operation` | `REMOVE` An atomic destroy destroy operation
    `static Operation` | `REMOVEALL_DESTROY` An entry distributed destroy caused by a removeAll.
    `static Operation` | `REPLACE` An atomic update operation
    `static Operation` | `SEARCH_CREATE` An entry creation caused by a netsearch
    `static Operation` | `SEARCH_UPDATE` An entry update caused by a net search.
    `static Operation` | `UPDATE` An entry update.
    `static Operation` | `UPDATE_VERSION_STAMP` An internal operation used to update the version stamp of an entry.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static Operation` | `fromOrdinal(byte ordinal)` Return the Operation represented by specified ordinal
    `Operation` | `getCorrespondingCreateOp()` Returns the create operation that corresponds to this operation.
    `Operation` | `getCorrespondingUpdateOp()` Returns the update operation that corresponds to this operation.
    `boolean` | `guaranteesOldValue()` Returns true if this operation is a ConcurrentMap operation that guarantees the old value to be returned no matter what expense may be incurred in doing so.
    `boolean` | `isClear()` Returns true if the operation cleared the region.
    `boolean` | `isClose()` Returns true if the operation closed the cache or a region.
    `boolean` | `isContainsKey()` Returns true if this operation checks whether given key is present in region.
    `boolean` | `isContainsValue()` Returns true if this operation checks whether given value is present in region.
    `boolean` | `isContainsValueForKey()` Returns true if this operation checks whether value is present for the given key.
    `boolean` | `isCreate()` Returns true if this operation created a new entry.
    `boolean` | `isDestroy()` Returns true if the operation destroyed an entry.
    `boolean` | `isDistributed()` Returns true if the operation may be distributed.
    `boolean` | `isEntry()` Returns true if the operation applies to a single entry.
    `boolean` | `isEviction()` Answer true if this operation resulted from eviction
    `boolean` | `isExpiration()` Answer true if this operation resulted from expiration.
    `boolean` | `isFunctionExecution()` Returns true if this operation is function execution operation.
    `boolean` | `isGet()` Returns true if this operation gets the value for given key.
    `boolean` | `isGetEntry()` Returns true if this operation gets the entry for given key.
    `boolean` | `isGetForRegisterInterest()` Returns true if this operation is a get for register interest.
    `boolean` | `isInvalidate()` Returns true if the operation invalidated an entry.
    `boolean` | `isLoad()` Returns true if this operation included running a loader.
    `boolean` | `isLocal()` Returns true if the operation is limited to the local cache.
    `boolean` | `isLocalLoad()` Returns true if this operation included a loader running in this cache.
    `boolean` | `isNetLoad()` Returns true if this operation included a loader running that was remote from the cache that requested it, i.e., a netLoad.
    `boolean` | `isNetSearch()` Returns true if this operation included a `netSearch`.
    `boolean` | `isPutAll()` Returns true if this operation was initiated by a putAll.
    `boolean` | `isRegion()` Returns true if the operation applies to the entire region.
    `boolean` | `isRegionDestroy()` Returns true if the operation destroyed a region.
    `boolean` | `isRegionInvalidate()` Returns true if the operation invalidated a region.
    `boolean` | `isRemoveAll()` Returns true if this operation was initiated by a removeAll.
    `boolean` | `isSearchOrLoad()` Returns true if this operation was a `net search` or a `load`.
    `boolean` | `isUpdate()` Returns true if this operation updated an existing entry.
    `java.lang.String` | `toString()` Returns a string representation for this operation.

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

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

- - ### Field Detail

    - #### MARKER

          public static final Operation MARKER

      A marker operation.

    - #### CREATE

          public static final Operation CREATE

      An entry creation.
      See Also:
        `Region.create(Object, Object)`

    - #### PUTALL_CREATE

          public static final Operation PUTALL_CREATE

      An entry creation caused by a putAll invocation
      See Also:
        `Region.putAll(java.util.Map<? extends K, ? extends V>)`

    - #### GET

          public static final Operation GET

      A 'value for key' operation.
      See Also:
        `Region.get(Object)`

    - #### GET_ENTRY

          public static final Operation GET_ENTRY

      A 'entry for key' operation.
      See Also:
        `Region.getEntry(Object)`

    - #### CONTAINS_KEY

          public static final Operation CONTAINS_KEY

      A 'check for existence of key' operation.
      See Also:
        `Region.containsKey(Object)`

    - #### CONTAINS_VALUE

          public static final Operation CONTAINS_VALUE

      A 'check for existence of value' operation.
      See Also:
        `Region.containsValueForKey(Object)`

    - #### CONTAINS_VALUE_FOR_KEY

          public static final Operation CONTAINS_VALUE_FOR_KEY

      A 'check for existence of value for given key' operation.
      See Also:
        `Region.containsValueForKey(Object)`

    - #### FUNCTION_EXECUTION

          public static final Operation FUNCTION_EXECUTION

      A 'function execution' operation.
      See Also:
        `FunctionService`

    - #### SEARCH_CREATE

          public static final Operation SEARCH_CREATE

      An entry creation caused by a netsearch
      See Also:
        `Region.get(Object)`

    - #### LOCAL_LOAD_CREATE

          public static final Operation LOCAL_LOAD_CREATE

      An entry creation caused by a local loader
      See Also:
        `Region.get(Object)`, `CacheLoader`

    - #### NET_LOAD_CREATE

          public static final Operation NET_LOAD_CREATE

      An entry creation caused by a net loader
      See Also:
        `Region.get(Object)`, `CacheLoader`

    - #### UPDATE

          public static final Operation UPDATE

      An entry update.
      See Also:
        `Region.put(Object, Object)`

    - #### PUTALL_UPDATE

          public static final Operation PUTALL_UPDATE

      An entry update caused by a putAll invocation.
      See Also:
        `Region.putAll(java.util.Map<? extends K, ? extends V>)`

    - #### SEARCH_UPDATE

          public static final Operation SEARCH_UPDATE

      An entry update caused by a net search.
      See Also:
        `Region.get(Object)`

    - #### LOCAL_LOAD_UPDATE

          public static final Operation LOCAL_LOAD_UPDATE

      An entry update caused by a local load.
      See Also:
        `Region.get(Object)`, `CacheLoader`

    - #### NET_LOAD_UPDATE

          public static final Operation NET_LOAD_UPDATE

      An entry update caused by a net load.
      See Also:
        `Region.get(Object)`, `CacheLoader`

    - #### INVALIDATE

          public static final Operation INVALIDATE

      An entry distributed invalidate.
      See Also:
        `Region.invalidate(Object)`

    - #### LOCAL_INVALIDATE

          public static final Operation LOCAL_INVALIDATE

      An entry local invalidate.
      See Also:
        `Region.localInvalidate(Object)`

    - #### DESTROY

          public static final Operation DESTROY

      An entry distributed destroy.
      See Also:
        `Region.destroy(Object)`

    - #### LOCAL_DESTROY

          public static final Operation LOCAL_DESTROY

      An entry local destroy.
      See Also:
        `Region.localDestroy(Object)`

    - #### EVICT_DESTROY

          public static final Operation EVICT_DESTROY

      An entry local destroy caused by an eviction.
      See Also:
        `Region.localDestroy(Object)`

    - #### REGION_LOAD_SNAPSHOT

          public static final Operation REGION_LOAD_SNAPSHOT

      A region load snapshot.
      See Also:
        `Region.loadSnapshot(java.io.InputStream)`

    - #### REGION_LOCAL_DESTROY

          public static final Operation REGION_LOCAL_DESTROY

      A region local destroy.
      See Also:
        `Region.localDestroyRegion()`

    - #### REGION_CREATE

          public static final Operation REGION_CREATE

      A region create.
      See Also:
        `Region.createSubregion(java.lang.String, org.apache.geode.cache.RegionAttributes<SK, SV>)`, `Cache.createRegion(java.lang.String, org.apache.geode.cache.RegionAttributes<K, V>)`

    - #### REGION_CLOSE

          public static final Operation REGION_CLOSE

      A region close
      See Also:
        `Region.close()`

    - #### REGION_DESTROY

          public static final Operation REGION_DESTROY

      A region distributed destroy.
      See Also:
        `Region.destroyRegion()`

    - #### EXPIRE_DESTROY

          public static final Operation EXPIRE_DESTROY

      An entry distributed destroy triggered by expiration
      See Also:
        `RegionAttributes.getEntryTimeToLive()`, `RegionAttributes.getEntryIdleTimeout()`, `ExpirationAction.DESTROY`

    - #### EXPIRE_LOCAL_DESTROY

          public static final Operation EXPIRE_LOCAL_DESTROY

      An entry local destroy triggered by expiration
      See Also:
        `RegionAttributes.getEntryTimeToLive()`, `RegionAttributes.getEntryIdleTimeout()`, `ExpirationAction.LOCAL_DESTROY`

    - #### EXPIRE_INVALIDATE

          public static final Operation EXPIRE_INVALIDATE

      An entry distributed invalidate triggered by expiration
      See Also:
        `RegionAttributes.getEntryTimeToLive()`, `RegionAttributes.getEntryIdleTimeout()`, `ExpirationAction.INVALIDATE`

    - #### EXPIRE_LOCAL_INVALIDATE

          public static final Operation EXPIRE_LOCAL_INVALIDATE

      An entry local invalidate triggered by expiration
      See Also:
        `RegionAttributes.getEntryTimeToLive()`, `RegionAttributes.getEntryIdleTimeout()`, `ExpirationAction.LOCAL_INVALIDATE`

    - #### REGION_EXPIRE_DESTROY

          public static final Operation REGION_EXPIRE_DESTROY

      A region distributed destroy triggered by expiration
      See Also:
        `RegionAttributes.getRegionTimeToLive()`, `RegionAttributes.getRegionIdleTimeout()`, `ExpirationAction.DESTROY`

    - #### REGION_EXPIRE_LOCAL_DESTROY

          public static final Operation REGION_EXPIRE_LOCAL_DESTROY

      A region local destroy triggered by expiration
      See Also:
        `RegionAttributes.getRegionTimeToLive()`, `RegionAttributes.getRegionIdleTimeout()`, `ExpirationAction.LOCAL_DESTROY`

    - #### REGION_EXPIRE_INVALIDATE

          public static final Operation REGION_EXPIRE_INVALIDATE

      A region distributed invalidate triggered by expiration
      See Also:
        `RegionAttributes.getRegionTimeToLive()`, `RegionAttributes.getRegionIdleTimeout()`, `ExpirationAction.INVALIDATE`

    - #### REGION_EXPIRE_LOCAL_INVALIDATE

          public static final Operation REGION_EXPIRE_LOCAL_INVALIDATE

      A region local invalidate triggered by expiration
      See Also:
        `RegionAttributes.getRegionTimeToLive()`, `RegionAttributes.getRegionIdleTimeout()`, `ExpirationAction.LOCAL_INVALIDATE`

    - #### REGION_LOCAL_INVALIDATE

          public static final Operation REGION_LOCAL_INVALIDATE

      A region local invalidate.
      See Also:
        `Region.localInvalidateRegion()`

    - #### REGION_INVALIDATE

          public static final Operation REGION_INVALIDATE

      A region distributed invalidate.
      See Also:
        `Region.invalidateRegion()`

    - #### REGION_CLEAR

          public static final Operation REGION_CLEAR

      A region clear.
      See Also:
        `Region.clear()`

    - #### REGION_LOCAL_CLEAR

          public static final Operation REGION_LOCAL_CLEAR

      A region local clear.
      See Also:
        `Region.localClear()`

    - #### CACHE_CREATE

          public static final Operation CACHE_CREATE

      A cache create. Note that this is marked as a region operation.
      See Also:
        `CacheFactory.create(org.apache.geode.distributed.DistributedSystem)`

    - #### CACHE_CLOSE

          public static final Operation CACHE_CLOSE

      A cache close. Note that this is marked as a region operation.
      See Also:
        `RegionService.close()`

    - #### FORCED_DISCONNECT

          public static final Operation FORCED_DISCONNECT

      A cache close due to being forced out of the distributed system by other members. This typically happens when a member becomes unresponsive and does not respond to heartbeat requests within the "member-timeout" period.
      Note that this is marked as a region operation.

    - #### REGION_REINITIALIZE

          public static final Operation REGION_REINITIALIZE

      A region destroy triggered by `ResumptionAction.REINITIALIZE`.
      See Also:
        `ResumptionAction.REINITIALIZE`

    - #### CACHE_RECONNECT

          public static final Operation CACHE_RECONNECT

      A cache close triggered by `LossAction.RECONNECT`.
      See Also:
        `LossAction.RECONNECT`

    - #### PUT_IF_ABSENT

          public static final Operation PUT_IF_ABSENT

      An atomic entry creation operation
      Since:
        GemFire 6.5
      See Also:
        `ConcurrentMap.putIfAbsent(Object, Object)`

    - #### REPLACE

          public static final Operation REPLACE

      An atomic update operation
      Since:
        GemFire 6.5
      See Also:
        `ConcurrentMap.replace(Object, Object, Object)`

    - #### REMOVE

          public static final Operation REMOVE

      An atomic destroy destroy operation
      Since:
        GemFire 6.5
      See Also:
        `ConcurrentMap.remove(Object, Object)`

    - #### UPDATE_VERSION_STAMP

          public static final Operation UPDATE_VERSION_STAMP

      An internal operation used to update the version stamp of an entry.

    - #### REMOVEALL_DESTROY

          public static final Operation REMOVEALL_DESTROY

      An entry distributed destroy caused by a removeAll.
      Since:
        GemFire 8.1
      See Also:
        `Region.removeAll(java.util.Collection)`

    - #### GET_FOR_REGISTER_INTEREST

          public static final Operation GET_FOR_REGISTER_INTEREST

      A 'get for register interest' operation.

    - #### ordinal

          public final byte ordinal

      byte used as ordinal to represent this Operation

  - ### Method Detail

    - #### fromOrdinal

          public static Operation fromOrdinal(byte ordinal)

      Return the Operation represented by specified ordinal

    - #### isCreate

          public boolean isCreate()

      Returns true if this operation created a new entry.

    - #### isUpdate

          public boolean isUpdate()

      Returns true if this operation updated an existing entry.

    - #### isGet

          public boolean isGet()

      Returns true if this operation gets the value for given key.

    - #### isContainsKey

          public boolean isContainsKey()

      Returns true if this operation checks whether given key is present in region.

    - #### isContainsValue

          public boolean isContainsValue()

      Returns true if this operation checks whether given value is present in region.

    - #### isContainsValueForKey

          public boolean isContainsValueForKey()

      Returns true if this operation checks whether value is present for the given key.

    - #### isFunctionExecution

          public boolean isFunctionExecution()

      Returns true if this operation is function execution operation.

    - #### isGetEntry

          public boolean isGetEntry()

      Returns true if this operation gets the entry for given key.

    - #### isGetForRegisterInterest

          public boolean isGetForRegisterInterest()

      Returns true if this operation is a get for register interest.

    - #### isInvalidate

          public boolean isInvalidate()

      Returns true if the operation invalidated an entry.

    - #### isDestroy

          public boolean isDestroy()

      Returns true if the operation destroyed an entry.

    - #### isClear

          public boolean isClear()

      Returns true if the operation cleared the region.

    - #### isClose

          public boolean isClose()

      Returns true if the operation closed the cache or a region.

    - #### isPutAll

          public boolean isPutAll()

      Returns true if this operation was initiated by a putAll.

    - #### isRemoveAll

          public boolean isRemoveAll()

      Returns true if this operation was initiated by a removeAll.
      Since:
        GemFire 8.1
      See Also:
        `Region.removeAll(java.util.Collection)`

    - #### isRegionInvalidate

          public boolean isRegionInvalidate()

      Returns true if the operation invalidated a region.

    - #### isRegionDestroy

          public boolean isRegionDestroy()

      Returns true if the operation destroyed a region.

    - #### isRegion

          public boolean isRegion()

      Returns true if the operation applies to the entire region.

    - #### isLocal

          public boolean isLocal()

      Returns true if the operation is limited to the local cache.

    - #### isDistributed

          public boolean isDistributed()

      Returns true if the operation may be distributed.

    - #### isEntry

          public boolean isEntry()

      Returns true if the operation applies to a single entry.

    - #### isExpiration

          public boolean isExpiration()

      Answer true if this operation resulted from expiration.
      Returns:
        true if this operation resulted from expiration

    - #### isEviction

          public boolean isEviction()

      Answer true if this operation resulted from eviction
      Returns:
        true if this operatino resulted from eviction

    - #### isLocalLoad

          public boolean isLocalLoad()

      Returns true if this operation included a loader running in this cache. Note that this will be true even if the local loader called `netSearch`. If this operation is for a Partitioned Region, then true will be returned if the loader ran in the same VM as where the data is hosted. If true is returned, and `CacheEvent.isOriginRemote()` is true, it means the data is not hosted locally, but the loader was run local to the data.
      Returns:
        true if this operation included a local loader execution

    - #### isNetLoad

          public boolean isNetLoad()

      Returns true if this operation included a loader running that was remote from the cache that requested it, i.e., a netLoad. Note that the cache that requested the netLoad may not be this cache.
      Returns:
        true if this operation included a netLoad

    - #### isLoad

          public boolean isLoad()

      Returns true if this operation included running a loader.
      Returns:
        true if isLocalLoad or isNetLoad

    - #### isNetSearch

          public boolean isNetSearch()

      Returns true if this operation included a `netSearch`. If the `netSearch` was invoked by a loader however, this will return false and `isLocalLoad()` or `isNetLoad()` will return true instead.
      Returns:
        true if this operation included a netSearch

    - #### isSearchOrLoad

          public boolean isSearchOrLoad()

      Returns true if this operation was a `net search` or a `load`.
      Returns:
        true if this operation include a netSearch or any type of load.

    - #### guaranteesOldValue

          public boolean guaranteesOldValue()

      Returns true if this operation is a ConcurrentMap operation that guarantees the old value to be returned no matter what expense may be incurred in doing so.
      Returns:
        true if this operation has this guarantee
      Since:
        GemFire 6.5

    - #### getCorrespondingUpdateOp

          public Operation getCorrespondingUpdateOp()

      Returns the update operation that corresponds to this operation. For a create operation the corresponding update op is returned. For all other operations `this` is returned.

    - #### getCorrespondingCreateOp

          public Operation getCorrespondingCreateOp()

      Returns the create operation that corresponds to this operation. For an update operation the corresponding create op is returned. For all other operations `this` is returned.

    - #### toString

          public java.lang.String toString()

      Returns a string representation for this operation.
      Overrides:
        `toString` in class `java.lang.Object`
      Returns:
        the name of this operation.