AtomicLong¶
-
class
AtomicLong
(client, service_name, name)¶ Bases:
hazelcast.proxy.base.PartitionSpecificProxy
AtomicLong is a redundant and highly available distributed long value which can be updated atomically.
-
add_and_get
(delta)¶ Atomically adds the given delta value to the currently stored value.
Parameters: delta – (long), the value to add to the currently stored value. Returns: (long), the updated value.
-
alter
(function)¶ Alters the currently stored value by applying a function on it.
Parameters: function – (Function), A stateful serializable object which represents the Function defined on server side. This object must have a serializable Function counter part registered on server side with the actual org.hazelcast.core.IFunction
implementation.
-
alter_and_get
(function)¶ Alters the currently stored value by applying a function on it and gets the result.
Parameters: function – (Function), A stateful serializable object which represents the Function defined on server side. This object must have a serializable Function counter part registered on server side with the actual org.hazelcast.core.IFunction
implementation.Returns: (long), the new value.
-
apply
(function)¶ Applies a function on the value, the actual stored value will not change.
Parameters: function – (Function), A stateful serializable object which represents the Function defined on server side. This object must have a serializable Function counter part registered on server side with the actual org.hazelcast.core.IFunction
implementation.Returns: (object), the result of the function application.
-
compare_and_set
(expected, updated)¶ Atomically sets the value to the given updated value only if the current value == the expected value.
Parameters: - expected – (long), the expected value.
- updated – (long), the new value.
Returns: (bool),
true
if successful; orfalse
if the actual value was not equal to the expected value.
-
decrement_and_get
()¶ Atomically decrements the current value by one.
Returns: (long), the updated value, the current value decremented by one.
-
get
()¶ Gets the current value.
Returns: (long), gets the current value.
-
get_and_add
(delta)¶ Atomically adds the given value to the current value.
Parameters: delta – (long), the value to add to the current value. Returns: (long), the old value before the addition.
-
get_and_alter
(function)¶ Alters the currently stored value by applying a function on it on and gets the old value.
Parameters: function – (Function), A stateful serializable object which represents the Function defined on server side. This object must have a serializable Function counter part registered on server side with the actual org.hazelcast.core.IFunction
implementation.Returns: (long), the old value.
-
get_and_set
(new_value)¶ Atomically sets the given value and returns the old value.
Parameters: new_value – (long), the new value. Returns: (long), the old value.
-
increment_and_get
()¶ Atomically increments the current value by one.
Returns: (long), the updated value, the current value incremented by one.
-
get_and_increment
()¶ Atomically increments the current value by one.
Returns: (long), the old value.
-
set
(new_value)¶ Atomically sets the given value.
Parameters: new_value – (long), the new value.
-