org.apache.cassandra.db

## Class CounterMutation

- java.lang.Object
- - org.apache.cassandra.db.CounterMutation

- All Implemented Interfaces:
    IMutation

      public class CounterMutation
      extends java.lang.Object
      implements IMutation

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `CounterMutation.CounterMutationSerializer`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static CounterMutation.CounterMutationSerializer` | `serializer`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `CounterMutation(Mutation mutation, ConsistencyLevel consistency)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `apply()`
    `Mutation` | `applyCounterMutation()` Applies the counter mutation, returns the result Mutation (for replication to other nodes).
    `ConsistencyLevel` | `consistency()`
    `java.util.Collection<java.util.UUID>` | `getColumnFamilyIds()`
    `java.lang.String` | `getKeyspaceName()`
    `Mutation` | `getMutation()`
    `java.util.Collection<PartitionUpdate>` | `getPartitionUpdates()`
    `long` | `getTimeout()`
    `DecoratedKey` | `key()`
    `MessageOut<CounterMutation>` | `makeMutationMessage()`
    `java.lang.String` | `toString()`
    `java.lang.String` | `toString(boolean shallow)`

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

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

- - ### Field Detail

    - #### serializer

          public static final CounterMutation.CounterMutationSerializer serializer

  - ### Constructor Detail

    - #### CounterMutation

          public CounterMutation(Mutation mutation,
                                 ConsistencyLevel consistency)

  - ### Method Detail

    - #### getKeyspaceName

          public java.lang.String getKeyspaceName()

      Specified by:
        `getKeyspaceName` in interface `IMutation`

    - #### getColumnFamilyIds

          public java.util.Collection<java.util.UUID> getColumnFamilyIds()

      Specified by:
        `getColumnFamilyIds` in interface `IMutation`

    - #### getPartitionUpdates

          public java.util.Collection<PartitionUpdate> getPartitionUpdates()

      Specified by:
        `getPartitionUpdates` in interface `IMutation`

    - #### getMutation

          public Mutation getMutation()

    - #### key

          public DecoratedKey key()

      Specified by:
        `key` in interface `IMutation`

    - #### consistency

          public ConsistencyLevel consistency()

    - #### makeMutationMessage

          public MessageOut<CounterMutation> makeMutationMessage()

    - #### applyCounterMutation

          public Mutation applyCounterMutation()
                                        throws WriteTimeoutException

      Applies the counter mutation, returns the result Mutation (for replication to other nodes). 1. Grabs the striped cell-level locks in the proper order 2. Gets the current values of the counters-to-be-modified from the counter cache 3. Reads the rest of the current values (cache misses) from the CF 4. Writes the updated counter values 5. Updates the counter cache 6. Releases the lock(s) See CASSANDRA-4775 and CASSANDRA-6504 for further details.
      Returns:
        the applied resulting Mutation
      Throws:
        `WriteTimeoutException`

    - #### apply

          public void apply()

      Specified by:
        `apply` in interface `IMutation`

    - #### getTimeout

          public long getTimeout()

      Specified by:
        `getTimeout` in interface `IMutation`

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`

    - #### toString

          public java.lang.String toString(boolean shallow)

      Specified by:
        `toString` in interface `IMutation`

Copyright © 2018 The Apache Software Foundation