X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fconfig%2Fconfig-manager%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fconfig%2Fmanager%2Fimpl%2Fdependencyresolver%2FDestroyedModule.java;h=6f4ed6366a6d95383c6651184934c1794e1684d6;hb=2b78ca93f44c372fd72927db6cbd65f5d8387b49;hp=05c10077c46f07e25b36a2811b836c1725a1493b;hpb=597ffbbfe362fcea479b7fdb52f685289b7ea5fd;p=controller.git diff --git a/opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/dependencyresolver/DestroyedModule.java b/opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/dependencyresolver/DestroyedModule.java index 05c10077c4..6f4ed6366a 100644 --- a/opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/dependencyresolver/DestroyedModule.java +++ b/opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/dependencyresolver/DestroyedModule.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. + * Copyright (c) 2013, 2017 Cisco Systems, Inc. and others. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0 which accompanies this distribution, @@ -9,6 +9,7 @@ package org.opendaylight.controller.config.manager.impl.dependencyresolver; import org.opendaylight.controller.config.api.ModuleIdentifier; import org.opendaylight.controller.config.manager.impl.jmx.ModuleJMXRegistrator; +import org.opendaylight.controller.config.manager.impl.jmx.RootRuntimeBeanRegistratorImpl; import org.opendaylight.controller.config.manager.impl.osgi.BeanToOsgiServiceManager.OsgiRegistration; import org.opendaylight.yangtools.concepts.Identifiable; import org.slf4j.Logger; @@ -30,40 +31,51 @@ public class DestroyedModule implements AutoCloseable, private final ModuleJMXRegistrator oldJMXRegistrator; private final OsgiRegistration osgiRegistration; private final int orderingIdx; + private final RootRuntimeBeanRegistratorImpl runtimeBeanRegistrator; - public DestroyedModule(ModuleIdentifier identifier, AutoCloseable instance, - ModuleJMXRegistrator oldJMXRegistrator, - OsgiRegistration osgiRegistration, int orderingIdx) { + public DestroyedModule(final ModuleIdentifier identifier, final AutoCloseable instance, + final ModuleJMXRegistrator oldJMXRegistrator, + final OsgiRegistration osgiRegistration, final int orderingIdx, + final RootRuntimeBeanRegistratorImpl runtimeBeanRegistrator) { this.identifier = identifier; this.instance = instance; this.oldJMXRegistrator = oldJMXRegistrator; this.osgiRegistration = osgiRegistration; this.orderingIdx = orderingIdx; + this.runtimeBeanRegistrator = runtimeBeanRegistrator; } @Override + @SuppressWarnings("IllegalCatch") public void close() { LOG.trace("Destroying {}", identifier); try { instance.close(); - } catch (Exception e) { + } catch (final Exception e) { LOG.error("Error while closing instance of {}", identifier, e); } try { oldJMXRegistrator.close(); - } catch (Exception e) { + } catch (final Exception e) { LOG.error("Error while closing jmx registrator of {}", identifier, e); } + try { + if (runtimeBeanRegistrator != null) { + runtimeBeanRegistrator.close(); + } + } catch (final Exception e) { + LOG.error("Error while closing runtime bean jmx registrator of {}", identifier, e); + } try { osgiRegistration.close(); - } catch (Exception e) { + } catch (final Exception e) { LOG.error("Error while closing osgi registration of {}", identifier, e); } } @Override - public int compareTo(DestroyedModule o) { - return Integer.compare(orderingIdx, o.orderingIdx); + public int compareTo(final DestroyedModule destroyedModule) { + return Integer.compare(orderingIdx, destroyedModule.orderingIdx); } @Override