Package org.apache.synapse.commons.throttle.core

## Class SharedParamManager

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

-     public class SharedParamManager
      extends Object

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `SharedParamManager()` |

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static long` | `addAndGetDistributedCounter​(String id, long value)` | Add given value to the distribute counter of caller context of given id.
    `static long` | `asyncGetAndAddDistributedCounter​(String id, long value)` | Asynchronously add given value to the distribute counter of caller context of given id.
    `static long` | `asyncGetAndAlterDistributedCounter​(String id, long value)` | Asynchronously add given value to the distribute counter of caller context of given id.
    `static long` | `getDistributedCounter​(String id)` | Return distributed shared counter for this caller context with given id.
    `static long` | `getSharedTimestamp​(String id)` | Return hazelcast shared timestamp for this caller context with given id.
    `static void` | `removeCounter​(String id)` | Destroy hazelcast global counter, if it's local then remove the map entry
    `static void` | `removeTimestamp​(String id)` | Destroy hazelcast shared timggestamp counter, if it's local then remove the map entry
    `static void` | `setDistributedCounter​(String id, long value)` | Set distribute counter of caller context of given id to the provided value.
    `static void` | `setExpiryTime​(String id, long expiryTimeStamp)` |
    `static void` | `setSharedTimestamp​(String id, long timestamp)` | Set distribute timestamp of caller context of given id to the provided value.

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

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

- - ### Constructor Detail

    - #### SharedParamManager

          public SharedParamManager()

  - ### Method Detail

    - #### getDistributedCounter

          public static long getDistributedCounter​(String id)

      Return distributed shared counter for this caller context with given id. If it's not distributed will get from the local counter
      Parameters:
        `id` - of the shared counter
      Returns:
        shared hazelcast current shared counter

    - #### setDistributedCounter

          public static void setDistributedCounter​(String id,
                                                   long value)

      Set distribute counter of caller context of given id to the provided value. If it's not distributed do the same for local counter
      Parameters:
        `id` - of the caller context
        `value` - to set to the global counter

    - #### addAndGetDistributedCounter

          public static long addAndGetDistributedCounter​(String id,
                                                         long value)

      Add given value to the distribute counter of caller context of given id. If it's not distributed return local counter
      Parameters:
        `id` - of the caller context
        `value` - to set to the global counter

    - #### asyncGetAndAddDistributedCounter

          public static long asyncGetAndAddDistributedCounter​(String id,
                                                              long value)

      Asynchronously add given value to the distribute counter of caller context of given id. If it's not distributed return local counter. This will return global value before add the provided counter
      Parameters:
        `id` - of the caller context
        `value` - to set to the global counter

    - #### asyncGetAndAlterDistributedCounter

          public static long asyncGetAndAlterDistributedCounter​(String id,
                                                                long value)

      Asynchronously add given value to the distribute counter of caller context of given id. If it's not distributed return local counter. This will return global value before add the provided counter
      Parameters:
        `id` - of the caller context
        `value` - to set to the global counter

    - #### removeCounter

          public static void removeCounter​(String id)

      Destroy hazelcast global counter, if it's local then remove the map entry
      Parameters:
        `id` - of the caller context

    - #### getSharedTimestamp

          public static long getSharedTimestamp​(String id)

      Return hazelcast shared timestamp for this caller context with given id. If it's not distributed will get from the local counter
      Parameters:
        `id` - of the shared counter
      Returns:
        shared hazelcast current shared counter

    - #### setSharedTimestamp

          public static void setSharedTimestamp​(String id,
                                                long timestamp)

      Set distribute timestamp of caller context of given id to the provided value. If it's not distributed do the same for local counter
      Parameters:
        `id` - of the caller context
        `timestamp` - to set to the global counter

    - #### removeTimestamp

          public static void removeTimestamp​(String id)

      Destroy hazelcast shared timggestamp counter, if it's local then remove the map entry
      Parameters:
        `id` - of the caller context

    - #### setExpiryTime

          public static void setExpiryTime​(String id,
                                           long expiryTimeStamp)