File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
mantis-control-plane/mantis-control-plane-server/src/main/java/io/mantisrx/master/resourcecluster Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change 2020
2121import akka .actor .AbstractActorWithTimers ;
2222import akka .actor .ActorRef ;
23+ import akka .actor .OneForOneStrategy ;
2324import akka .actor .Props ;
2425import akka .actor .Status ;
26+ import akka .actor .SupervisorStrategy ;
27+ import akka .japi .pf .DeciderBuilder ;
2528import akka .japi .pf .ReceiveBuilder ;
2629import com .netflix .spectator .api .Tag ;
2730import com .netflix .spectator .api .TagList ;
9598@ ToString (of = {"clusterID" })
9699@ Slf4j
97100class ResourceClusterActor extends AbstractActorWithTimers {
101+ /**
102+ * For ResourceClusterActor instances, we need to ensure they are always running after encountering error so that
103+ * TaskExecutors can still remain connected. If there is a fatal error that needs to be escalated to terminate the
104+ * whole system/leader you can define a fatal exception type and override its behavior to
105+ * SupervisorStrategy.escalate() instead.
106+ */
107+ private static SupervisorStrategy resourceClusterActorStrategy =
108+ new OneForOneStrategy (
109+ 3 ,
110+ Duration .ofSeconds (60 ),
111+ DeciderBuilder
112+ .match (Exception .class , e -> SupervisorStrategy .restart ())
113+ .build ());
114+
115+ @ Override
116+ public SupervisorStrategy supervisorStrategy () {
117+ return resourceClusterActorStrategy ;
118+ }
98119
99120 private final Duration heartbeatTimeout ;
100121 private final Duration assignmentTimeout ;
You can’t perform that action at this time.
0 commit comments