package org.opendaylight.yang.gen.v1.urn.opendaylight.nic.gbp.renderer.impl.rev150511;

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.LogicalDatastoreType;
import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker.DataChangeScope;
import org.opendaylight.nic.gbp.renderer.impl.GBPRenderer;
import org.opendaylight.yang.gen.v1.urn.opendaylight.intent.rev150122.Intents;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;

public class GBPRendererModule extends org.opendaylight.yang.gen.v1.urn.opendaylight.nic.gbp.renderer.impl.rev150511.AbstractGBPRendererModule {
    public GBPRendererModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
        super(identifier, dependencyResolver);
    }

    public GBPRendererModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.yang.gen.v1.urn.opendaylight.nic.gbp.renderer.impl.rev150511.GBPRendererModule oldModule, java.lang.AutoCloseable oldInstance) {
        super(identifier, dependencyResolver, oldModule, oldInstance);
    }

    @Override
    public void customValidation() {
        // add custom validation form module attributes here.
    }

    @Override
    public java.lang.AutoCloseable createInstance() {
        DataBroker broker = getDataBrokerDependency();

        LogicalDatastoreType store = LogicalDatastoreType.CONFIGURATION;
        InstanceIdentifier<Intents> path = InstanceIdentifier.builder(Intents.class).build();

        GBPRenderer renderer = new GBPRenderer();
        DataChangeScope scope = DataChangeScope.SUBTREE;
        ListenerRegistration<DataChangeListener> reg = broker.registerDataChangeListener(store, path, renderer, scope);

        return renderer;
    }

}

@@ -279,34 +279,45 @@
 pi.data.
-LogicalDatastoreTy
+AsyncDataBroker.DataChangeSco
 pe;%0Aimpo
@@ -374,37 +374,26 @@
 ata.
-AsyncDataBroker.DataChangeSco
+LogicalDatastoreTy
 pe;%0A
@@ -661,16 +661,73 @@
 ntifier;
+%0Aimport org.slf4j.Logger;%0Aimport org.slf4j.LoggerFactory;
 %0A%0Apublic
@@ -865,16 +865,106 @@
 odule %7B%0A
+%0A    private static final Logger LOG = LoggerFactory.getLogger(GBPRendererModule.class);%0A%0A
     publ
@@ -2005,16 +2005,22 @@
         
+final 
 GBPRende
@@ -2118,16 +2118,22 @@
         
+final 
 Listener
@@ -2249,23 +2249,550 @@
     
-return renderer
+final class CloseResources implements AutoCloseable %7B%0A            @Override%0A            public void close() throws Exception %7B%0A                if (renderer != null) %7B%0A                    renderer.close();%0A                %7D%0A                if (reg != null) %7B%0A                    reg.close();%0A                %7D%0A                LOG.info(%22GBG Renderer (instance %7B%7D) torn down.%22, this);%0A            %7D%0A        %7D%0A%0A        AutoCloseable ret = new CloseResources();%0A        LOG.info(%22GBG Renderer: (instance %7B%7D) initialized.%22, ret);%0A        return ret
 ;%0A  

Add AutoClosable instance to GBPRendererModule createInstance().