diff options
author | Jon Bratseth <bratseth@oath.com> | 2018-05-30 11:39:26 +0200 |
---|---|---|
committer | Jon Bratseth <bratseth@oath.com> | 2018-05-30 11:39:26 +0200 |
commit | 4919fb84be7edc03f7c7feb0080ff0c5f705f654 (patch) | |
tree | 4eb3d1a1032c6a329b05acc05af4acc4eb0594e8 /container-di/src/main | |
parent | 9bfecc00be5716933ec305aa9161f68c4dca4200 (diff) |
Run reconfigurer thread even when restartOnRedeploy is true
Diffstat (limited to 'container-di/src/main')
-rw-r--r-- | container-di/src/main/scala/com/yahoo/container/di/Container.scala | 16 |
1 files changed, 9 insertions, 7 deletions
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 5ea6422ddad..0ef01e5aa3d 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 @@ -44,9 +44,9 @@ class Container( var leastGeneration = -1L @throws(classOf[InterruptedException]) - def runOnce( - oldGraph: ComponentGraph = new ComponentGraph, - fallbackInjector: GuiceInjector = Guice.createInjector()): ComponentGraph = { + def getNewConfigGraph(oldGraph: ComponentGraph = new ComponentGraph, + fallbackInjector: GuiceInjector = Guice.createInjector(), + restartOnRedeploy: Boolean = false): ComponentGraph = { def deconstructObsoleteComponents(oldGraph: ComponentGraph, newGraph: ComponentGraph) { val oldComponents = new IdentityHashMap[AnyRef, AnyRef]() @@ -56,7 +56,8 @@ class Container( } try { - val newGraph = createNewGraph(oldGraph, fallbackInjector) + val newGraph = getConfigAndCreateGraph(oldGraph, fallbackInjector) + if (restartOnRedeploy) return oldGraph // wait for restart to cause reconfig instead newGraph.reuseNodes(oldGraph) constructComponents(newGraph) deconstructObsoleteComponents(oldGraph, newGraph) @@ -113,10 +114,11 @@ class Container( } } - final def createNewGraph(graph: ComponentGraph = new ComponentGraph, - fallbackInjector: Injector): ComponentGraph = { + final def getConfigAndCreateGraph(graph: ComponentGraph = new ComponentGraph, + fallbackInjector: Injector): ComponentGraph = { val snapshot = configurer.getConfigs(graph.configKeys, leastGeneration) + log.log(DEBUG, """createNewGraph: |graph.configKeys = %s @@ -138,7 +140,7 @@ class Container( |previous generation: %d""" .format(getBootstrapGeneration, getComponentsGeneration, previousConfigGeneration).stripMargin) installBundles(configs) - createNewGraph( + getConfigAndCreateGraph( createComponentsGraph(configs, getBootstrapGeneration,fallbackInjector), fallbackInjector) case ComponentsConfigs(configs) => |