X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;ds=sidebyside;f=opendaylight%2Fnetconf%2Fnetconf-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Fimpl%2Fosgi%2FAggregatedNetconfOperationServiceFactory.java;h=ae68ecc120b5fb502a0c362d023ff81b7f469509;hb=fb3ca10a354d54d067201f18943504c212b93613;hp=c299ac7d1a4f5623e89dbfd8bade655b8044cc89;hpb=f7055779b6842da666504afc91d23c07a88a565a;p=controller.git diff --git a/opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/osgi/AggregatedNetconfOperationServiceFactory.java b/opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/osgi/AggregatedNetconfOperationServiceFactory.java index c299ac7d1a..ae68ecc120 100644 --- a/opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/osgi/AggregatedNetconfOperationServiceFactory.java +++ b/opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/osgi/AggregatedNetconfOperationServiceFactory.java @@ -22,12 +22,13 @@ import org.opendaylight.controller.netconf.api.monitoring.CapabilityListener; import org.opendaylight.controller.netconf.mapping.api.NetconfOperation; import org.opendaylight.controller.netconf.mapping.api.NetconfOperationService; import org.opendaylight.controller.netconf.mapping.api.NetconfOperationServiceFactory; +import org.opendaylight.controller.netconf.mapping.api.NetconfOperationServiceFactoryListener; import org.opendaylight.controller.netconf.util.CloseableUtil; /** * NetconfOperationService aggregator. Makes a collection of operation services accessible as one. */ -public class AggregatedNetconfOperationServiceFactory implements NetconfOperationServiceFactory, NetconfOperationServiceFactoryListener { +public class AggregatedNetconfOperationServiceFactory implements NetconfOperationServiceFactory, NetconfOperationServiceFactoryListener, AutoCloseable { private final Set factories = new HashSet<>(); private final Multimap registrations = HashMultimap.create(); @@ -96,6 +97,16 @@ public class AggregatedNetconfOperationServiceFactory implements NetconfOperatio return new AggregatedNetconfOperation(factories, netconfSessionIdForReporting); } + @Override + public synchronized void close() throws Exception { + factories.clear(); + for (AutoCloseable reg : registrations.values()) { + reg.close(); + } + registrations.clear(); + listeners.clear(); + } + private static final class AggregatedNetconfOperation implements NetconfOperationService { private final Set services;