Move {Identifiable,Persistent,}Payload
[controller.git] / opendaylight / md-sal / eos-dom-akka / src / main / java / org / opendaylight / controller / eos / akka / bootstrap / EOSMain.java
index be1415e..dab699e 100644 (file)
@@ -9,6 +9,7 @@ package org.opendaylight.controller.eos.akka.bootstrap;
 
 import akka.actor.typed.ActorRef;
 import akka.actor.typed.Behavior;
+import akka.actor.typed.SupervisorStrategy;
 import akka.actor.typed.javadsl.AbstractBehavior;
 import akka.actor.typed.javadsl.ActorContext;
 import akka.actor.typed.javadsl.Behaviors;
@@ -43,12 +44,13 @@ public final class EOSMain extends AbstractBehavior<BootstrapCommand> {
         final String role = Cluster.get(context.getSystem()).selfMember().getRoles().iterator().next();
 
         listenerRegistry = context.spawn(EntityTypeListenerRegistry.create(role), "ListenerRegistry");
-        candidateRegistry = context.spawn(CandidateRegistryInit.create(), "CandidateRegistry");
 
         final ClusterSingleton clusterSingleton = ClusterSingleton.get(context.getSystem());
         // start the initial sync behavior that switches to the regular one after syncing
         ownerSupervisor = clusterSingleton.init(
-                SingletonActor.of(IdleSupervisor.create(iidCodec), "OwnerSupervisor"));
+                SingletonActor.of(Behaviors.supervise(IdleSupervisor.create(iidCodec))
+                        .onFailure(SupervisorStrategy.restart()), "OwnerSupervisor"));
+        candidateRegistry = context.spawn(CandidateRegistryInit.create(ownerSupervisor), "CandidateRegistry");
 
         ownerStateChecker = context.spawn(OwnerStateChecker.create(role, ownerSupervisor, iidCodec),
                 "OwnerStateChecker");
@@ -73,7 +75,7 @@ public final class EOSMain extends AbstractBehavior<BootstrapCommand> {
     }
 
     private Behavior<BootstrapCommand> onTerminate(final Terminate request) {
-        request.getReplyTo().tell(Empty.getInstance());
+        request.getReplyTo().tell(Empty.value());
         return Behaviors.stopped();
     }
 }
\ No newline at end of file