Package akka.cluster.ddata
Class LWWRegister<A>
- java.lang.Object
-
- akka.cluster.ddata.LWWRegister<A>
-
- All Implemented Interfaces:
ReplicatedData
,ReplicatedDataSerialization
,java.io.Serializable
,scala.Serializable
public final class LWWRegister<A> extends java.lang.Object implements ReplicatedData, ReplicatedDataSerialization
Java API- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
LWWRegister.Clock<A>
-
Constructor Summary
Constructors Constructor Description LWWRegister(UniqueAddress node, A value, long timestamp)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static <A> LWWRegister<A>
apply(SelfUniqueAddress node, A initialValue)
static <A> LWWRegister<A>
apply(SelfUniqueAddress node, A initialValue, LWWRegister.Clock<A> clock)
static <A> LWWRegister<A>
apply(UniqueAddress node, A initialValue, LWWRegister.Clock<A> clock)
INTERNAL APIstatic <A> LWWRegister<A>
apply(A initialValue, Cluster node, LWWRegister.Clock<A> clock)
Deprecated.Use `apply` that takes a `SelfUniqueAddress` parameter instead.static <A> LWWRegister.Clock<A>
apply$default$3(A initialValue)
static <A> LWWRegister<A>
create(Cluster node, A initialValue)
Deprecated.Use `create` that takes a `SelfUniqueAddress` parameter instead.static <A> LWWRegister<A>
create(Cluster node, A initialValue, LWWRegister.Clock<A> clock)
Deprecated.Use `create` that takes a `SelfUniqueAddress` parameter instead.static <A> LWWRegister<A>
create(SelfUniqueAddress node, A initialValue)
Java APIstatic <A> LWWRegister<A>
create(SelfUniqueAddress node, A initialValue, LWWRegister.Clock<A> clock)
Java APIstatic <A> LWWRegister<A>
create(A initialValue, SelfUniqueAddress node, LWWRegister.Clock<A> clock)
Scala API Creates aLWWRegister
with implicits, given deprecatedapply
functions using Cluster constrain overloading.static <A> LWWRegister.Clock<A>
create$default$3(A initialValue)
static <A> LWWRegister.Clock<A>
defaultClock()
The defaultLWWRegister.Clock
is using max value ofSystem.currentTimeMillis()
andcurrentTimestamp + 1
.boolean
equals(java.lang.Object o)
A
getValue()
Java APIint
hashCode()
LWWRegister<A>
merge(LWWRegister<A> that)
INTERNAL APIUniqueAddress
node()
static <A> LWWRegister.Clock<A>
reverseClock()
ThisLWWRegister.Clock
can be used for first-write-wins semantics.long
timestamp()
java.lang.String
toString()
static <A> scala.Option<A>
unapply(LWWRegister<A> c)
Extract thevalue()
.UniqueAddress
updatedBy()
The currentvalue
was set by this node.A
value()
LWWRegister<A>
withValue(Cluster node, A value)
Deprecated.Use `withValue` that takes a `SelfUniqueAddress` parameter instead.LWWRegister<A>
withValue(Cluster node, A value, LWWRegister.Clock<A> clock)
Deprecated.Use `withValue` that takes a `SelfUniqueAddress` parameter instead.LWWRegister<A>
withValue(SelfUniqueAddress node, A value)
Change the value of the register.LWWRegister<A>
withValue(SelfUniqueAddress node, A value, LWWRegister.Clock<A> clock)
Change the value of the register.LWWRegister<A>
withValue(UniqueAddress node, A value, LWWRegister.Clock<A> clock)
INTERNAL APILWWRegister<A>
withValue(A value, Cluster node, LWWRegister.Clock<A> clock)
Deprecated.Use `withValueOf` that takes a `SelfUniqueAddress` parameter instead.LWWRegister.Clock<A>
withValue$default$3(A value)
LWWRegister<A>
withValueOf(A value, SelfUniqueAddress node, LWWRegister.Clock<A> clock)
Change the value of the register.LWWRegister.Clock<A>
withValueOf$default$3(A value)
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface akka.cluster.ddata.ReplicatedData
merge
-
-
-
-
Constructor Detail
-
LWWRegister
public LWWRegister(UniqueAddress node, A value, long timestamp)
-
-
Method Detail
-
defaultClock
public static <A> LWWRegister.Clock<A> defaultClock()
The defaultLWWRegister.Clock
is using max value ofSystem.currentTimeMillis()
andcurrentTimestamp + 1
.- Returns:
- (undocumented)
-
reverseClock
public static <A> LWWRegister.Clock<A> reverseClock()
ThisLWWRegister.Clock
can be used for first-write-wins semantics. It is using min value of-System.currentTimeMillis()
andcurrentTimestamp + 1
, i.e. it is counting backwards.- Returns:
- (undocumented)
-
apply
public static <A> LWWRegister<A> apply(UniqueAddress node, A initialValue, LWWRegister.Clock<A> clock)
INTERNAL API- Parameters:
node
- (undocumented)initialValue
- (undocumented)clock
- (undocumented)- Returns:
- (undocumented)
-
apply
public static <A> LWWRegister<A> apply(SelfUniqueAddress node, A initialValue)
-
apply
public static <A> LWWRegister<A> apply(SelfUniqueAddress node, A initialValue, LWWRegister.Clock<A> clock)
-
apply
public static <A> LWWRegister<A> apply(A initialValue, Cluster node, LWWRegister.Clock<A> clock)
Deprecated.Use `apply` that takes a `SelfUniqueAddress` parameter instead. Since 2.5.20.
-
apply$default$3
public static <A> LWWRegister.Clock<A> apply$default$3(A initialValue)
-
create
public static <A> LWWRegister<A> create(A initialValue, SelfUniqueAddress node, LWWRegister.Clock<A> clock)
Scala API Creates aLWWRegister
with implicits, given deprecatedapply
functions using Cluster constrain overloading.- Parameters:
initialValue
- (undocumented)node
- (undocumented)clock
- (undocumented)- Returns:
- (undocumented)
-
create
public static <A> LWWRegister<A> create(Cluster node, A initialValue)
Deprecated.Use `create` that takes a `SelfUniqueAddress` parameter instead. Since 2.5.20.Java API- Parameters:
node
- (undocumented)initialValue
- (undocumented)- Returns:
- (undocumented)
-
create
public static <A> LWWRegister<A> create(Cluster node, A initialValue, LWWRegister.Clock<A> clock)
Deprecated.Use `create` that takes a `SelfUniqueAddress` parameter instead. Since 2.5.20.Java API- Parameters:
node
- (undocumented)initialValue
- (undocumented)clock
- (undocumented)- Returns:
- (undocumented)
-
create
public static <A> LWWRegister<A> create(SelfUniqueAddress node, A initialValue, LWWRegister.Clock<A> clock)
Java API- Parameters:
node
- (undocumented)initialValue
- (undocumented)clock
- (undocumented)- Returns:
- (undocumented)
-
create
public static <A> LWWRegister<A> create(SelfUniqueAddress node, A initialValue)
Java API- Parameters:
node
- (undocumented)initialValue
- (undocumented)- Returns:
- (undocumented)
-
create$default$3
public static <A> LWWRegister.Clock<A> create$default$3(A initialValue)
-
unapply
public static <A> scala.Option<A> unapply(LWWRegister<A> c)
Extract thevalue()
.- Parameters:
c
- (undocumented)- Returns:
- (undocumented)
-
node
public UniqueAddress node()
-
value
public A value()
-
timestamp
public long timestamp()
-
getValue
public A getValue()
Java API- Returns:
- (undocumented)
-
withValue
public LWWRegister<A> withValue(SelfUniqueAddress node, A value, LWWRegister.Clock<A> clock)
Change the value of the register.You can provide your
clock
implementation instead of using timestamps based onSystem.currentTimeMillis()
time. The timestamp can for example be an increasing version number from a database record that is used for optimistic concurrency control.- Parameters:
node
- (undocumented)value
- (undocumented)clock
- (undocumented)- Returns:
- (undocumented)
-
withValue
public LWWRegister<A> withValue(SelfUniqueAddress node, A value)
Change the value of the register.- Parameters:
node
- (undocumented)value
- (undocumented)- Returns:
- (undocumented)
-
withValueOf
public LWWRegister<A> withValueOf(A value, SelfUniqueAddress node, LWWRegister.Clock<A> clock)
Change the value of the register.You can provide your
clock
implementation instead of using timestamps based onSystem.currentTimeMillis()
time. The timestamp can for example be an increasing version number from a database record that is used for optimistic concurrency control.- Parameters:
value
- (undocumented)node
- (undocumented)clock
- (undocumented)- Returns:
- (undocumented)
-
withValue
public LWWRegister<A> withValue(A value, Cluster node, LWWRegister.Clock<A> clock)
Deprecated.Use `withValueOf` that takes a `SelfUniqueAddress` parameter instead. Since 2.5.20.
-
withValue
public LWWRegister<A> withValue(Cluster node, A value)
Deprecated.Use `withValue` that takes a `SelfUniqueAddress` parameter instead. Since 2.5.20.
-
withValue
public LWWRegister<A> withValue(Cluster node, A value, LWWRegister.Clock<A> clock)
Deprecated.Use `withValue` that takes a `SelfUniqueAddress` parameter instead. Since 2.5.20.
-
updatedBy
public UniqueAddress updatedBy()
The currentvalue
was set by this node.- Returns:
- (undocumented)
-
withValue
public LWWRegister<A> withValue(UniqueAddress node, A value, LWWRegister.Clock<A> clock)
INTERNAL API- Parameters:
node
- (undocumented)value
- (undocumented)clock
- (undocumented)- Returns:
- (undocumented)
-
withValueOf$default$3
public LWWRegister.Clock<A> withValueOf$default$3(A value)
-
withValue$default$3
public LWWRegister.Clock<A> withValue$default$3(A value)
-
merge
public LWWRegister<A> merge(LWWRegister<A> that)
INTERNAL API- Parameters:
that
- (undocumented)- Returns:
- (undocumented)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-