The actor may fail, for example due to AskTimeoutException. This still
needs to be investigated, but mitigate the failure by adding an
OwnerSupervisor to restart it on failure.
JIRA: CONTROLLER-2035
Change-Id: I2dafaa35804357415d9aaa5400372cfd8e54b85b
Signed-off-by: Shibu Vijayakumar <shibu.vijayakumar@infosys.com>
import akka.actor.typed.ActorRef;
import akka.actor.typed.Behavior;
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;
import akka.actor.typed.javadsl.AbstractBehavior;
import akka.actor.typed.javadsl.ActorContext;
import akka.actor.typed.javadsl.Behaviors;
final ClusterSingleton clusterSingleton = ClusterSingleton.get(context.getSystem());
// start the initial sync behavior that switches to the regular one after syncing
ownerSupervisor = clusterSingleton.init(
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),
candidateRegistry = context.spawn(CandidateRegistryInit.create(ownerSupervisor), "CandidateRegistry");
ownerStateChecker = context.spawn(OwnerStateChecker.create(role, ownerSupervisor, iidCodec),