From: Shibu Vijayakumar Date: Fri, 1 Apr 2022 18:14:34 +0000 (+0000) Subject: Add supervisor to EOS singleton actor X-Git-Tag: v5.0.2~6 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=7d48c55ad33bcb69e9e373b3e169b530771e60ab Add supervisor to EOS singleton actor 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 --- diff --git a/opendaylight/md-sal/eos-dom-akka/src/main/java/org/opendaylight/controller/eos/akka/bootstrap/EOSMain.java b/opendaylight/md-sal/eos-dom-akka/src/main/java/org/opendaylight/controller/eos/akka/bootstrap/EOSMain.java index 83d28823ad..dab699e394 100644 --- a/opendaylight/md-sal/eos-dom-akka/src/main/java/org/opendaylight/controller/eos/akka/bootstrap/EOSMain.java +++ b/opendaylight/md-sal/eos-dom-akka/src/main/java/org/opendaylight/controller/eos/akka/bootstrap/EOSMain.java @@ -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; @@ -47,8 +48,8 @@ public final class EOSMain extends AbstractBehavior { 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),