org.apache.synapse.commons.throttle.core

## Class HazelcastDistributedCounterManager

- java.lang.Object
- - org.apache.synapse.commons.throttle.core.HazelcastDistributedCounterManager

- All Implemented Interfaces:
    DistributedCounterManager

      public class HazelcastDistributedCounterManager
      extends java.lang.Object
      implements DistributedCounterManager

  Distributed Counter implementation for HazelCast.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `HazelcastDistributedCounterManager()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `long` | `addAndGetCounter(java.lang.String key, long value)` This method used to add and return the distributed counter value.
    `long` | `asyncGetAndAddCounter(java.lang.String key, long value)` This method used to update distributed counter asynchronously.
    `long` | `asyncGetAndAlterCounter(java.lang.String key, long value)` This method used to alter the DistributedCounter.
    `long` | `getCounter(java.lang.String key)` Returns the Distributed Counter for specific key.
    `long` | `getTimestamp(java.lang.String key)` This method returns shared TimeStamp of distributed Key.
    `java.lang.String` | `getType()`
    `boolean` | `isEnable()`
    `void` | `removeCounter(java.lang.String key)` This method used to remove specified key.
    `void` | `removeTimestamp(java.lang.String key)` This method removes the timestamp relevant to key.
    `void` | `setCounter(java.lang.String key, long value)` Sets the Distributed counter with value.
    `void` | `setExpiry(java.lang.String key, long expiryTimeStamp)`
    `void` | `setTimestamp(java.lang.String key, long timeStamp)` This method set the Timestamp to distributed map.

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

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

- - ### Constructor Detail

    - #### HazelcastDistributedCounterManager

          public HazelcastDistributedCounterManager()

  - ### Method Detail

    - #### getCounter

          public long getCounter(java.lang.String key)

      Description copied from interface: `DistributedCounterManager`
      Returns the Distributed Counter for specific key.
      Specified by:
        `getCounter` in interface `DistributedCounterManager`
      Parameters:
        `key` - key to check in distributed map.
      Returns:
        value of distributed counter.

    - #### setCounter

          public void setCounter(java.lang.String key,
                                 long value)

      Description copied from interface: `DistributedCounterManager`
      Sets the Distributed counter with value.
      Specified by:
        `setCounter` in interface `DistributedCounterManager`
      Parameters:
        `key` - key to add in distributed map.
        `value` - value of distributed counter.

    - #### addAndGetCounter

          public long addAndGetCounter(java.lang.String key,
                                       long value)

      Description copied from interface: `DistributedCounterManager`
      This method used to add and return the distributed counter value.
      Specified by:
        `addAndGetCounter` in interface `DistributedCounterManager`
      Parameters:
        `key` - key to add in distributed map.
        `value` - value to add to distributed counter.
      Returns:
        added value of distributed counter.

    - #### removeCounter

          public void removeCounter(java.lang.String key)

      Description copied from interface: `DistributedCounterManager`
      This method used to remove specified key.
      Specified by:
        `removeCounter` in interface `DistributedCounterManager`
      Parameters:
        `key` - key to check in distributed map.

    - #### asyncGetAndAddCounter

          public long asyncGetAndAddCounter(java.lang.String key,
                                            long value)

      Description copied from interface: `DistributedCounterManager`
      This method used to update distributed counter asynchronously.
      Specified by:
        `asyncGetAndAddCounter` in interface `DistributedCounterManager`
      Parameters:
        `key` - key to check in distributed map.
        `value` - value to add to distributed counter.
      Returns:
        the original distributed counter value.

    - #### asyncGetAndAlterCounter

          public long asyncGetAndAlterCounter(java.lang.String key,
                                              long value)

      Description copied from interface: `DistributedCounterManager`
      This method used to alter the DistributedCounter.
      Specified by:
        `asyncGetAndAlterCounter` in interface `DistributedCounterManager`
      Parameters:
        `key` - key to check in distributed map.
        `value` - value of distributed counter.
      Returns:
        the original distributed counter value.

    - #### getTimestamp

          public long getTimestamp(java.lang.String key)

      Description copied from interface: `DistributedCounterManager`
      This method returns shared TimeStamp of distributed Key.
      Specified by:
        `getTimestamp` in interface `DistributedCounterManager`
      Parameters:
        `key` - key to check in distributed map.
      Returns:
        timestamp value of key.

    - #### setTimestamp

          public void setTimestamp(java.lang.String key,
                                   long timeStamp)

      Description copied from interface: `DistributedCounterManager`
      This method set the Timestamp to distributed map.
      Specified by:
        `setTimestamp` in interface `DistributedCounterManager`
      Parameters:
        `key` - key to add in distributed map.
        `timeStamp` - timestamp to add.

    - #### removeTimestamp

          public void removeTimestamp(java.lang.String key)

      Description copied from interface: `DistributedCounterManager`
      This method removes the timestamp relevant to key.
      Specified by:
        `removeTimestamp` in interface `DistributedCounterManager`
      Parameters:
        `key` - key to check in distributed map.

    - #### isEnable

          public boolean isEnable()

      Specified by:
        `isEnable` in interface `DistributedCounterManager`

    - #### getType

          public java.lang.String getType()

      Specified by:
        `getType` in interface `DistributedCounterManager`

    - #### setExpiry

          public void setExpiry(java.lang.String key,
                                long expiryTimeStamp)

      Specified by:
        `setExpiry` in interface `DistributedCounterManager`

Copyright © 2005-2022 Apache Software Foundation. All Rights Reserved.