Class DistributedData
- java.lang.Object
-
- akka.cluster.ddata.typed.javadsl.DistributedData
-
- All Implemented Interfaces:
Extension
public abstract class DistributedData extends java.lang.Object implements Extension
Akka extension for convenient configuration and use of theReplicator
. Configuration settings are defined in theakka.cluster.ddata
section, seereference.conf
.This is using the same underlying
Replicator
instance asDistributedData
and that means that typed and classic actors can share the same data.This class is not intended for user extension other than for test purposes (e.g. stub implementation). More methods may be added in the future and that may break such implementations.
-
-
Constructor Summary
Constructors Constructor Description DistributedData()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static T
apply(ActorSystem<?> system)
static DistributedData
createExtension(ActorSystem<?> system)
static boolean
equals(java.lang.Object other)
static DistributedData
get(ActorSystem<?> system)
static int
hashCode()
static ExtensionId<T>
id()
abstract ActorRef<Replicator.Command>
replicator()
ActorRef
of theReplicator
.abstract SelfUniqueAddress
selfUniqueAddress()
static <A,B extends ReplicatedData>
Behavior<A>withReplicatorMessageAdapter(java.util.function.Function<ReplicatorMessageAdapter<A,B>,Behavior<A>> factory)
When interacting with theDistributedData.replicator
from an actor theReplicatorMessageAdapter
provides convenient methods that adapts the response messages to the requesting actor's message protocol.
-
-
-
Method Detail
-
get
public static DistributedData get(ActorSystem<?> system)
-
createExtension
public static DistributedData createExtension(ActorSystem<?> system)
-
withReplicatorMessageAdapter
public static <A,B extends ReplicatedData> Behavior<A> withReplicatorMessageAdapter(java.util.function.Function<ReplicatorMessageAdapter<A,B>,Behavior<A>> factory)
When interacting with theDistributedData.replicator
from an actor theReplicatorMessageAdapter
provides convenient methods that adapts the response messages to the requesting actor's message protocol.One
ReplicatorMessageAdapter
instance can be used for a givenReplicatedData
type, e.g. anOrSet
. Interaction with severalKey
s can be used via the same adapter but they must all be of the sameReplicatedData
type. For interaction with several differentReplicatedData
types, e.g. anOrSet
and aGCounter
, an adapter can be created for each type.*Warning*: A
ReplicatorMessageAdapter
instance is not thread-safe and must only be used from a single actor It must not be accessed from threads other than the ordinary actor message processing thread, such asCompletionStage
callbacks. It must not be shared between several actor instances.- Parameters:
factory
- Factory of theBehavior
for the actor that is using theReplicatorMessageAdapter
-
apply
public static final T apply(ActorSystem<?> system)
-
hashCode
public static final int hashCode()
-
equals
public static final boolean equals(java.lang.Object other)
-
id
public static ExtensionId<T> id()
-
replicator
public abstract ActorRef<Replicator.Command> replicator()
ActorRef
of theReplicator
.- See Also:
DistributedData.withReplicatorMessageAdapter
-
selfUniqueAddress
public abstract SelfUniqueAddress selfUniqueAddress()
-
-