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.ddatasection, seereference.conf.This is using the same underlying
Replicatorinstance asDistributedDataand 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 Tapply(ActorSystem<?> system)static DistributedDatacreateExtension(ActorSystem<?> system)static booleanequals(java.lang.Object other)static DistributedDataget(ActorSystem<?> system)static inthashCode()static ExtensionId<T>id()abstract ActorRef<Replicator.Command>replicator()ActorRefof theReplicator.abstract SelfUniqueAddressselfUniqueAddress()static <A,B extends ReplicatedData>
Behavior<A>withReplicatorMessageAdapter(java.util.function.Function<ReplicatorMessageAdapter<A,B>,Behavior<A>> factory)When interacting with theDistributedData.replicatorfrom an actor theReplicatorMessageAdapterprovides 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.replicatorfrom an actor theReplicatorMessageAdapterprovides convenient methods that adapts the response messages to the requesting actor's message protocol.One
ReplicatorMessageAdapterinstance can be used for a givenReplicatedDatatype, e.g. anOrSet. Interaction with severalKeys can be used via the same adapter but they must all be of the sameReplicatedDatatype. For interaction with several differentReplicatedDatatypes, e.g. anOrSetand aGCounter, an adapter can be created for each type.*Warning*: A
ReplicatorMessageAdapterinstance 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 asCompletionStagecallbacks. It must not be shared between several actor instances.- Parameters:
factory- Factory of theBehaviorfor 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()
ActorRefof theReplicator.- See Also:
DistributedData.withReplicatorMessageAdapter
-
selfUniqueAddress
public abstract SelfUniqueAddress selfUniqueAddress()
-
-