Use try-with-resources
[controller.git] / opendaylight / blueprint / src / main / java / org / opendaylight / controller / blueprint / BlueprintContainerRestartServiceImpl.java
index 5adb4e51a60c8c3e9674bf03e244ab6da969142c..f3010a41387d21d4765b33309b9c45713270c7c1 100644 (file)
@@ -236,14 +236,13 @@ class BlueprintContainerRestartServiceImpl implements AutoCloseable, BlueprintCo
             return;
         }
 
-        ConfigSubsystemFacade configFacade = configFacadeFactory.createFacade("BlueprintContainerRestartService");
-        try {
+        try (ConfigSubsystemFacade configFacade = configFacadeFactory.createFacade(
+                "BlueprintContainerRestartService")) {
             restartConfigModules(configModules, configFacade);
         } catch (ParserConfigurationException | DocumentedException | ValidationException
                 | ConflictingVersionException e) {
             LOG.error("Error restarting config modules", e);
         } finally {
-            configFacade.close();
             bundleContext.ungetService(configFacadeFactoryRef);
         }