diff options
author | Bjørn Christian Seime <bjorncs@verizonmedia.com> | 2022-02-04 11:25:32 +0100 |
---|---|---|
committer | Bjørn Christian Seime <bjorncs@verizonmedia.com> | 2022-02-04 11:33:25 +0100 |
commit | b6e3efdfe6ecb423834c8344c0cd881db1c0c51b (patch) | |
tree | eadc3e06b3dfc7049432b16561e2e0a73417fcac /container-core/src | |
parent | 9b0dd155ccff27ec50634dfd77dedc7ba69681ac (diff) |
Deconstruct partial graph if construction fail
Diffstat (limited to 'container-core/src')
-rw-r--r-- | container-core/src/main/java/com/yahoo/container/di/Container.java | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/container-core/src/main/java/com/yahoo/container/di/Container.java b/container-core/src/main/java/com/yahoo/container/di/Container.java index d7c94af2a97..526b201c886 100644 --- a/container-core/src/main/java/com/yahoo/container/di/Container.java +++ b/container-core/src/main/java/com/yahoo/container/di/Container.java @@ -76,7 +76,15 @@ public class Container { Collection<Bundle> obsoleteBundles = new HashSet<>(); ComponentGraph newGraph = waitForNewConfigGenAndCreateGraph(oldGraph, fallbackInjector, isInitializing, obsoleteBundles); newGraph.reuseNodes(oldGraph); - constructComponents(newGraph); + try { + constructComponents(newGraph); + } catch (Exception e) { + log.log(Level.WARNING, String.format( + "Failed to construct graph for generation '%d' - scheduling partial graph for deconstruction", + newGraph.generation()), e); + deconstructAllComponents(newGraph, componentDeconstructor); + throw e; + } Runnable cleanupTask = createPreviousGraphDeconstructionTask(oldGraph, newGraph, obsoleteBundles); return new ComponentGraphResult(newGraph, cleanupTask); } catch (Throwable t) { |