From 964b125720d82368ffce5e3bf10bbb6c1723b200 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tibor=20Kr=C3=A1l?= Date: Thu, 11 Jun 2020 10:28:55 +0200 Subject: [PATCH] Add option to disable default ActorSystemQuarantinedEvent handling MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- .../src/main/resources/initial/akka.conf | 1 + .../QuarantinedMonitorActorPropsFactory.java | 16 +++++++++++++++- .../OSGI-INF/blueprint/clustered-datastore.xml | 11 ++++++----- 3 files changed, 22 insertions(+), 6 deletions(-) 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 @@ - - - - + + + + + -- 2.36.6