Class SharedParamManager
java.lang.Object
org.apache.synapse.commons.throttle.core.SharedParamManager
-
Method Summary
Modifier and TypeMethodDescriptionstatic longaddAndGetDistributedCounter(String id, long value) Add given value to the distribute counter of caller context of given id.static longasyncGetAndAddDistributedCounter(String id, long value) Asynchronously add given value to the distribute counter of caller context of given id.static longasyncGetAndAlterDistributedCounter(String id, long value) Asynchronously add given value to the distribute counter of caller context of given id.static longReturn distributed shared counter for this caller context with given id.static longReturn hazelcast shared timestamp for this caller context with given id.static longGet the time-to-live value for the given keystatic booleanlockSharedKeys(String callerContextId, String lockValue) Acquire lock for the given callerContext (with the given value), so that another process cannot acquire the same lockstatic voidreleaseSharedKeys(String callerContextId) Release the lock of the given callerContextstatic voidremoveCounter(String id) Destroy hazelcast global counter, if it's local then remove the map entrystatic voidDestroy hazelcast shared timggestamp counter, if it's local then remove the map entrystatic voidsetDistributedCounter(String id, long value) Set distribute counter of caller context of given id to the provided value.static voidsetDistributedCounterWithExpiry(String id, long value, long expiryTime) Set the distributed counter with the given id key with an expiry timestatic voidsetExpiryTime(String id, long expiryTimeStamp) static voidsetSharedTimestamp(String id, long timestamp) Set distribute timestamp of caller context of given id to the provided value.static voidsetSharedTimestampWithExpiry(String id, long timestamp, long expiryTime) Set the shared timestamp with the given id key with an expiry time
-
Method Details
-
getDistributedCounter
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
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 contextvalue- to set to the global counter
-
setDistributedCounterWithExpiry
Set the distributed counter with the given id key with an expiry time- Parameters:
id- key idvalue- value to setexpiryTime- expiry time in milliseconds
-
addAndGetDistributedCounter
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 contextvalue- to set to the global counter
-
asyncGetAndAddDistributedCounter
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 contextvalue- to set to the global counter
-
asyncGetAndAlterDistributedCounter
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 contextvalue- to set to the global counter
-
removeCounter
Destroy hazelcast global counter, if it's local then remove the map entry- Parameters:
id- of the caller context
-
removeTimestamp
Destroy hazelcast shared timggestamp counter, if it's local then remove the map entry- Parameters:
id- of the caller context
-
setExpiryTime
-
getTtl
Get the time-to-live value for the given key- Parameters:
key- name key of the key- Returns:
- time-to-live value
-