From e37daeda6c094d9bffec0d0e0e49e9071d7ed647 Mon Sep 17 00:00:00 2001 From: gjoranv Date: Mon, 29 May 2017 15:34:19 +0200 Subject: Do not log InterruptedException | ConfigInterruptedException - Normal during shutdown. - See also that ConfiguredApp.startReconfigurerThread just ignores them. + Cleanup some unused code. + Add a couple TODOs --- .../src/main/scala/com/yahoo/container/di/Container.scala | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'container-di') diff --git a/container-di/src/main/scala/com/yahoo/container/di/Container.scala b/container-di/src/main/scala/com/yahoo/container/di/Container.scala index 0bd5b8264d6..cdec5dca04d 100644 --- a/container-di/src/main/scala/com/yahoo/container/di/Container.scala +++ b/container-di/src/main/scala/com/yahoo/container/di/Container.scala @@ -6,6 +6,7 @@ import java.util.logging.{Level, Logger} import com.google.inject.{Guice, Injector} import com.yahoo.config._ +import com.yahoo.config.subscription.ConfigInterruptedException import com.yahoo.container.bundle.BundleInstantiationSpecification import com.yahoo.container.di.ConfigRetriever.{BootstrapConfigs, ComponentsConfigs} import com.yahoo.container.di.Container._ @@ -62,6 +63,7 @@ class Container( } catch { case userException: ComponentConstructorException => invalidateGeneration(oldGraph.generation, userException) + // TODO: Wrap userException in an Error when generation==0 (+ unit test that Error is thrown) throw userException case t: Throwable => invalidateGeneration(oldGraph.generation, t) @@ -92,6 +94,7 @@ class Container( } } + // TODO: move to ConfiguredApplication def logAndDie(message: String, cause: Throwable): Unit = { log.log(Level.SEVERE, message, cause) try { @@ -102,13 +105,10 @@ class Container( Process.logAndDie("Exited for reason (repeated from above):", cause) } - val message = newGraphErrorMessage(generation, cause) - generation match { - // Disabled, as it breaks application based tests. - // case 0 => logAndDie(message, cause) - case _ => - log.log(Level.WARNING, message, cause) - leastGeneration = max(configurer.getComponentsGeneration, configurer.getBootstrapGeneration) + 1 + leastGeneration = max(configurer.getComponentsGeneration, configurer.getBootstrapGeneration) + 1 + cause match { + case _: InterruptedException | _: ConfigInterruptedException => // Normal during shutdown, do not log anything. + case _ => log.log(Level.WARNING, newGraphErrorMessage(generation, cause), cause) } } -- cgit v1.2.3