From e8215aef8cf2475512d7601fdaebcb1294e93fc7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tibor=20Kr=C3=A1l?= Date: Thu, 6 Feb 2020 12:19:42 +0100 Subject: [PATCH 1/1] Propagate TimeoutException when ActorSystem fails to terminate MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit ActorSystemProviderImpl waits 10s for the ActorSystem to terminate. If this timeout is reached propagate the resulting TimeoutException so the caller knows something went wrong. JIRA: CONTROLLER-1929 Change-Id: I6518600e2930e3a0a955215b24a9b3074730ff64 Signed-off-by: Tibor Král --- .../cluster/akka/impl/ActorSystemProviderImpl.java | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/akka/impl/ActorSystemProviderImpl.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/akka/impl/ActorSystemProviderImpl.java index 0d43250f5d..6e805b33d7 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/akka/impl/ActorSystemProviderImpl.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/akka/impl/ActorSystemProviderImpl.java @@ -11,6 +11,7 @@ import akka.actor.ActorSystem; import akka.actor.Props; import com.typesafe.config.Config; import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; import org.opendaylight.controller.cluster.ActorSystemProvider; import org.opendaylight.controller.cluster.ActorSystemProviderListener; import org.opendaylight.controller.cluster.common.actor.QuarantinedMonitorActor; @@ -51,14 +52,8 @@ public class ActorSystemProviderImpl implements ActorSystemProvider, AutoCloseab } @Override - @SuppressWarnings("checkstyle:IllegalCatch") - public void close() { + public void close() throws TimeoutException, InterruptedException { LOG.info("Shutting down ActorSystem"); - - try { - Await.result(actorSystem.terminate(), FiniteDuration.create(10, TimeUnit.SECONDS)); - } catch (final Exception e) { - LOG.warn("Error awaiting actor termination", e); - } + Await.result(actorSystem.terminate(), FiniteDuration.create(10, TimeUnit.SECONDS)); } } -- 2.36.6