From: Tibor Král Date: Thu, 11 Jun 2020 08:28:55 +0000 (+0200) Subject: Add option to disable default ActorSystemQuarantinedEvent handling X-Git-Tag: v2.0.3~24 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=964b125720d82368ffce5e3bf10bbb6c1723b200 Add option to disable default ActorSystemQuarantinedEvent handling The default reaction to ThisActorSystemQuarantinedEvent is to restart the entire Karaf container. However some users may want to process the event differently. JIRA: CONTROLLER-1949 Change-Id: Id65d31749dd97cb067611f7cfe4df76a6fe12204 Signed-off-by: Tibor Král Signed-off-by: Robert Varga --- diff --git a/opendaylight/md-sal/sal-clustering-config/src/main/resources/initial/akka.conf b/opendaylight/md-sal/sal-clustering-config/src/main/resources/initial/akka.conf index 26ebb83594..5cde9e4c46 100644 --- a/opendaylight/md-sal/sal-clustering-config/src/main/resources/initial/akka.conf +++ b/opendaylight/md-sal/sal-clustering-config/src/main/resources/initial/akka.conf @@ -35,5 +35,6 @@ odl-cluster-data { # snapshot-store.local.dir = "target/snapshots" } + disable-default-actor-system-quarantined-event-handling = "false" } } diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/akka/osgi/impl/QuarantinedMonitorActorPropsFactory.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/akka/osgi/impl/QuarantinedMonitorActorPropsFactory.java index 75872f4ddb..eb98c4f339 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/akka/osgi/impl/QuarantinedMonitorActorPropsFactory.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/akka/osgi/impl/QuarantinedMonitorActorPropsFactory.java @@ -8,6 +8,8 @@ package org.opendaylight.controller.cluster.akka.osgi.impl; import akka.actor.Props; +import com.typesafe.config.Config; +import com.typesafe.config.ConfigException; import org.opendaylight.controller.cluster.common.actor.QuarantinedMonitorActor; import org.osgi.framework.BundleContext; import org.slf4j.Logger; @@ -16,11 +18,23 @@ import org.slf4j.LoggerFactory; public final class QuarantinedMonitorActorPropsFactory { private static final Logger LOG = LoggerFactory.getLogger(QuarantinedMonitorActorPropsFactory.class); + private static final String DEFAULT_HANDLING_DISABLED = + "akka.disable-default-actor-system-quarantined-event-handling"; + private QuarantinedMonitorActorPropsFactory() { } - public static Props createProps(final BundleContext bundleContext) { + public static Props createProps(final BundleContext bundleContext, final Config akkaConfig) { + try { + if (akkaConfig.getBoolean(DEFAULT_HANDLING_DISABLED)) { + LOG.info("{} was set, default handling is disabled", DEFAULT_HANDLING_DISABLED); + return QuarantinedMonitorActor.props(() -> { }); + } + } catch (ConfigException configEx) { + LOG.info("Akka config doesn't contain property {}. Therefore default handling will be used", + DEFAULT_HANDLING_DISABLED); + } return QuarantinedMonitorActor.props(() -> { // restart the entire karaf container LOG.warn("Restarting karaf container"); diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/resources/OSGI-INF/blueprint/clustered-datastore.xml b/opendaylight/md-sal/sal-distributed-datastore/src/main/resources/OSGI-INF/blueprint/clustered-datastore.xml index 977674c59b..182a1b4085 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/resources/OSGI-INF/blueprint/clustered-datastore.xml +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/resources/OSGI-INF/blueprint/clustered-datastore.xml @@ -25,17 +25,18 @@ - - - - + + + + +