X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=groupbasedpolicy%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fconfig%2Fyang%2Fconfig%2Fopflex_provider%2Fimpl%2FOpflexProviderModule.java;h=10a12419c834a31e2a52eb7deefec23f6f0ff47e;hb=2fb4c5a6a43ac636e499a38c31d0000f6b969940;hp=1e73d1b5f0d14badc3cc2827d70124ecf60b6bd9;hpb=a87aaae8ed97eae9330e5d1a08f90971bb9f959b;p=groupbasedpolicy.git diff --git a/groupbasedpolicy/src/main/java/org/opendaylight/controller/config/yang/config/opflex_provider/impl/OpflexProviderModule.java b/groupbasedpolicy/src/main/java/org/opendaylight/controller/config/yang/config/opflex_provider/impl/OpflexProviderModule.java index 1e73d1b5f..10a12419c 100644 --- a/groupbasedpolicy/src/main/java/org/opendaylight/controller/config/yang/config/opflex_provider/impl/OpflexProviderModule.java +++ b/groupbasedpolicy/src/main/java/org/opendaylight/controller/config/yang/config/opflex_provider/impl/OpflexProviderModule.java @@ -1,6 +1,11 @@ package org.opendaylight.controller.config.yang.config.opflex_provider.impl; +import org.opendaylight.controller.md.sal.binding.api.DataBroker; +import org.opendaylight.controller.md.sal.binding.api.DataChangeListener; +import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker.DataChangeScope; +import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; import org.opendaylight.groupbasedpolicy.renderer.opflex.OpflexConnectionService; +import org.opendaylight.yangtools.concepts.ListenerRegistration; public class OpflexProviderModule extends org.opendaylight.controller.config.yang.config.opflex_provider.impl.AbstractOpflexProviderModule { public OpflexProviderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) { @@ -19,12 +24,20 @@ public class OpflexProviderModule extends org.opendaylight.controller.config.yan @Override public java.lang.AutoCloseable createInstance() { final OpflexConnectionService connectionService = new OpflexConnectionService(); - connectionService.setDataProvider(getDataBrokerDependency()); + DataBroker dataBrokerService = getDataBrokerDependency(); + + connectionService.setDataProvider(dataBrokerService); + final ListenerRegistration dataChangeListenerRegistration = + dataBrokerService + .registerDataChangeListener(LogicalDatastoreType.CONFIGURATION, + OpflexConnectionService.DISCOVERY_DEFINITIONS_IID, + connectionService, DataChangeScope.SUBTREE ); final class AutoCloseableConnectionService implements AutoCloseable { @Override public void close() throws Exception { connectionService.stopping(); + dataChangeListenerRegistration.close(); } } return new AutoCloseableConnectionService();