com.hazelcast.config

## Class PNCounterConfig

- java.lang.Object
- - com.hazelcast.config.PNCounterConfig

- All Implemented Interfaces:
    NamedConfig, DataSerializable, IdentifiedDataSerializable

      public class PNCounterConfig
      extends Object
      implements IdentifiedDataSerializable, NamedConfig

  Configuration for a `PNCounter`
  Since:
    3.10

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `DEFAULT_REPLICA_COUNT` The default number of replicas on which state for this CRDT is kept
    `static boolean` | `DEFAULT_STATISTICS_ENABLED` Default value for statistics enabled.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PNCounterConfig()`
    `PNCounterConfig(PNCounterConfig config)`
    `PNCounterConfig(String name)`
    `PNCounterConfig(String name, int replicaCount, String quorumName, boolean statisticsEnabled)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(Object o)`
    `int` | `getFactoryId()` Returns DataSerializableFactory factory ID for this class.
    `int` | `getId()` Returns type identifier for this class.
    `String` | `getName()` Gets the name of the PN counter.
    `String` | `getQuorumName()` Returns the quorum name for operations.
    `int` | `getReplicaCount()` Returns the number of replicas on which state for this PN counter will be kept.
    `int` | `hashCode()`
    `boolean` | `isStatisticsEnabled()` Checks if statistics are enabled for this PN counter
    `void` | `readData(ObjectDataInput in)` Reads fields from the input stream
    `PNCounterConfig` | `setName(String name)` Sets the name of the PN counter.
    `PNCounterConfig` | `setQuorumName(String quorumName)` Sets the quorum name for operations.
    `PNCounterConfig` | `setReplicaCount(int replicaCount)` Sets the number of replicas on which state for this PN counter will be kept.
    `PNCounterConfig` | `setStatisticsEnabled(boolean statisticsEnabled)` Enables or disables statistics for this PN counter
    `void` | `writeData(ObjectDataOutput out)` Writes object fields to output stream

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

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

- - ### Field Detail

    - #### DEFAULT_REPLICA_COUNT

          public static final int DEFAULT_REPLICA_COUNT

      The default number of replicas on which state for this CRDT is kept
      See Also:
        Constant Field Values

    - #### DEFAULT_STATISTICS_ENABLED

          public static final boolean DEFAULT_STATISTICS_ENABLED

      Default value for statistics enabled.
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### PNCounterConfig

          public PNCounterConfig()

    - #### PNCounterConfig

          public PNCounterConfig(String name,
                                 int replicaCount,
                                 String quorumName,
                                 boolean statisticsEnabled)

    - #### PNCounterConfig

          public PNCounterConfig(String name)

    - #### PNCounterConfig

          public PNCounterConfig(PNCounterConfig config)

  - ### Method Detail

    - #### getName

          public String getName()

      Gets the name of the PN counter.
      Specified by:
        `getName` in interface `NamedConfig`

    - #### setName

          public PNCounterConfig setName(String name)

      Sets the name of the PN counter.
      Specified by:
        `setName` in interface `NamedConfig`
      Parameters:
        `name` - the name of the PN counter
      Returns:
        the updated PN counter config

    - #### isStatisticsEnabled

          public boolean isStatisticsEnabled()

      Checks if statistics are enabled for this PN counter
      Returns:
        `true` if enabled, `false` otherwise

    - #### setStatisticsEnabled

          public PNCounterConfig setStatisticsEnabled(boolean statisticsEnabled)

      Enables or disables statistics for this PN counter
      Parameters:
        `statisticsEnabled` - `true` to enable statistics, `false` to disable
      Returns:
        the updated PN counter config

    - #### getReplicaCount

          public int getReplicaCount()

      Returns the number of replicas on which state for this PN counter will be kept. This number applies in quiescent state, if there are currently membership changes or clusters are merging, the state may be temporarily kept on more replicas.
      Returns:
        the number of replicas for the CRDT state

    - #### setReplicaCount

          public PNCounterConfig setReplicaCount(int replicaCount)

      Sets the number of replicas on which state for this PN counter will be kept. This number applies in quiescent state, if there are currently membership changes or clusters are merging, the state may be temporarily kept on more replicas.

      The provided `replicaCount` must be between 1 and .

      Parameters:
        `replicaCount` - the number of replicas for the CRDT state
      Returns:
        the updated PN counter config
      Throws:
        `ConfigurationException` - if the `replicaCount` is less than 1

    - #### getQuorumName

          public String getQuorumName()

      Returns the quorum name for operations.
      Returns:
        the quorum name

    - #### setQuorumName

          public PNCounterConfig setQuorumName(String quorumName)

      Sets the quorum name for operations.
      Parameters:
        `quorumName` - the quorum name
      Returns:
        the updated PN counter config

    - #### getFactoryId

          public int getFactoryId()

      Description copied from interface: `IdentifiedDataSerializable`
      Returns DataSerializableFactory factory ID for this class.
      Specified by:
        `getFactoryId` in interface `IdentifiedDataSerializable`
      Returns:
        factory ID

    - #### getId

          public int getId()

      Description copied from interface: `IdentifiedDataSerializable`
      Returns type identifier for this class. It should be unique per DataSerializableFactory.
      Specified by:
        `getId` in interface `IdentifiedDataSerializable`
      Returns:
        type ID

    - #### writeData

          public void writeData(ObjectDataOutput out)
                         throws IOException

      Description copied from interface: `DataSerializable`
      Writes object fields to output stream
      Specified by:
        `writeData` in interface `DataSerializable`
      Parameters:
        `out` - output
      Throws:
        `IOException` - if an I/O error occurs. In particular, an `IOException` may be thrown if the output stream has been closed.

    - #### readData

          public void readData(ObjectDataInput in)
                        throws IOException

      Description copied from interface: `DataSerializable`
      Reads fields from the input stream
      Specified by:
        `readData` in interface `DataSerializable`
      Parameters:
        `in` - input
      Throws:
        `IOException` - if an I/O error occurs. In particular, an `IOException` may be thrown if the input stream has been closed.

    - #### equals

          public boolean equals(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

Copyright © 2020. All rights reserved.