Interface DistributedCounterManager
public interface DistributedCounterManager
This interface used to replicate throttling counters and windows in distributed manner.
-
Method Summary
Modifier and TypeMethodDescriptionlongaddAndGetCounter(String key, long value) This method used to add and return the distributed counter value.longasyncAddCounter(String key, long value) This method is used to increment distributed counter asynchronously.longasyncGetAlterAndSetExpiryOfCounter(String key, long value, long expiryTimeStamp) This method is used to get and then alter and then set expiry time of the DistributedCounter.longasyncGetAndAddCounter(String key, long value) This method is used to get and then increment distributed counter asynchronously.longasyncGetAndAlterCounter(String key, long value) This method used to alter the DistributedCounter.longgetCounter(String key) Returns the Distributed Counter for specific key.longlonggetTimestamp(String key) This method returns shared TimeStamp of distributed Key.longgetType()booleanisEnable()voidremoveCounter(String key) This method used to remove specified key.voidremoveLock(String key) voidremoveTimestamp(String key) This method removes the timestamp relevant to key.voidsetCounter(String key, long value) Sets the Distributed counter with value.voidsetCounterWithExpiry(String key, long value, long expiryTime) Sets the Distributed counter with the given value while setting expiry time too.voidlongbooleansetLockWithExpiry(String key, String value, long expiryTimeStamp) voidsetTimestamp(String key, long timeStamp) This method set the Timestamp to distributed map.voidsetTimestampWithExpiry(String key, long timeStamp, long expiryTimeStamp) This method set the Timestamp to distributed map with an expiry time.
-
Method Details
-
getCounter
Returns the Distributed Counter for specific key.- Parameters:
key- key to check in distributed map.- Returns:
- value of distributed counter.
-
setCounter
Sets the Distributed counter with value.- Parameters:
key- key to add in distributed map.value- value of distributed counter.
-
setCounterWithExpiry
Sets the Distributed counter with the given value while setting expiry time too.- Parameters:
key- counter key namevalue- counter valueexpiryTime- expiry time in milliseconds
-
addAndGetCounter
This method used to add and return the distributed counter value.- Parameters:
key- key to add in distributed map.value- value to add to distributed counter.- Returns:
- added value of distributed counter.
-
removeCounter
This method used to remove specified key.- Parameters:
key- key to check in distributed map.
-
asyncGetAndAddCounter
This method is used to get and then increment distributed counter asynchronously.- Parameters:
key- key to check in distributed map.value- value to add to distributed counter.- Returns:
- the original distributed counter value.
-
asyncAddCounter
This method is used to increment distributed counter asynchronously.- Parameters:
key- key to update in distributed map.value- value to increment- Returns:
- the updated distributed counter value.
-
asyncGetAndAlterCounter
This method used to alter the DistributedCounter.- Parameters:
key- key to check in distributed map.value- value of distributed counter.- Returns:
- the original distributed counter value.
-
asyncGetAlterAndSetExpiryOfCounter
This method is used to get and then alter and then set expiry time of the DistributedCounter.- Parameters:
key- key to alter in distributed counter.value- value to alter in distributed counter.expiryTimeStamp- expiry time to set.- Returns:
- the original distributed counter value.
-
getTimestamp
This method returns shared TimeStamp of distributed Key.- Parameters:
key- key to check in distributed map.- Returns:
- timestamp value of key.
-
setTimestamp
This method set the Timestamp to distributed map.- Parameters:
key- key to add in distributed map.timeStamp- timestamp to add.
-
setTimestampWithExpiry
This method set the Timestamp to distributed map with an expiry time.- Parameters:
key- key to add in distributed map.timeStamp- timestamp to add.expiryTimeStamp- expiry timestamp to set
-
removeTimestamp
This method removes the timestamp relevant to key.- Parameters:
key- key to check in distributed map.
-
isEnable
boolean isEnable() -
getType
String getType() -
setExpiry
-
getTtl
-
setLock
-
setLockWithExpiry
-
getKeyLockRetrievalTimeout
long getKeyLockRetrievalTimeout() -
removeLock
-