import akka.actor.typed.ActorRef;
import akka.actor.typed.Behavior;
import akka.actor.typed.javadsl.AbstractBehavior;
import akka.actor.typed.ActorRef;
import akka.actor.typed.Behavior;
import akka.actor.typed.javadsl.AbstractBehavior;
import org.opendaylight.controller.eos.akka.owner.supervisor.command.InitialCandidateSync;
import org.opendaylight.controller.eos.akka.owner.supervisor.command.InitialOwnerSync;
import org.opendaylight.controller.eos.akka.owner.supervisor.command.OwnerSupervisorCommand;
import org.opendaylight.controller.eos.akka.owner.supervisor.command.InitialCandidateSync;
import org.opendaylight.controller.eos.akka.owner.supervisor.command.InitialOwnerSync;
import org.opendaylight.controller.eos.akka.owner.supervisor.command.OwnerSupervisorCommand;
// String representation of Entity to DOMEntity
private final Map<String, DOMEntity> entityLookup = new HashMap<>();
// String representation of Entity to DOMEntity
private final Map<String, DOMEntity> entityLookup = new HashMap<>();
- private OwnerSyncer(final ActorContext<OwnerSupervisorCommand> context) {
+ private OwnerSyncer(final ActorContext<OwnerSupervisorCommand> context,
+ final @Nullable ActorRef<OwnerSupervisorReply> notifyDatacenterStarted,
+ final BindingInstanceIdentifierCodec iidCodec) {
LOG.debug("Starting candidate and owner sync");
final ActorRef<Replicator.Command> replicator = DistributedData.get(context.getSystem()).replicator();
LOG.debug("Starting candidate and owner sync");
final ActorRef<Replicator.Command> replicator = DistributedData.get(context.getSystem()).replicator();
new ReplicatorMessageAdapter<OwnerSupervisorCommand, ORMap<DOMEntity, ORSet<String>>>(context, replicator,
Duration.ofSeconds(5)).askGet(
askReplyTo -> new Replicator.Get<>(CandidateRegistry.KEY, Replicator.readLocal(), askReplyTo),
InitialCandidateSync::new);
new ReplicatorMessageAdapter<OwnerSupervisorCommand, ORMap<DOMEntity, ORSet<String>>>(context, replicator,
Duration.ofSeconds(5)).askGet(
askReplyTo -> new Replicator.Get<>(CandidateRegistry.KEY, Replicator.readLocal(), askReplyTo),
InitialCandidateSync::new);
- public static Behavior<OwnerSupervisorCommand> create() {
- return Behaviors.setup(OwnerSyncer::new);
+ public static Behavior<OwnerSupervisorCommand> create(final ActorRef<OwnerSupervisorReply> notifyDatacenterStarted,
+ final BindingInstanceIdentifierCodec iidCodec) {
+ return Behaviors.setup(ctx -> new OwnerSyncer(ctx, notifyDatacenterStarted, iidCodec));
private Behavior<OwnerSupervisorCommand> switchToSupervisor() {
LOG.debug("Initial sync done, switching to supervisor. candidates: {}, owners: {}",
currentCandidates, currentOwners);
private Behavior<OwnerSupervisorCommand> switchToSupervisor() {
LOG.debug("Initial sync done, switching to supervisor. candidates: {}, owners: {}",
currentCandidates, currentOwners);
- return Behaviors.setup(ctx ->
- OwnerSupervisor.create(currentCandidates, currentOwners));
+ return Behaviors.setup(ctx -> OwnerSupervisor.create(currentCandidates, currentOwners, iidCodec));