Do not close ClusterSingletonServiceProvider in southbound
[lispflowmapping.git] / mappingservice / southbound / src / main / java / org / opendaylight / lispflowmapping / southbound / LispSouthboundPlugin.java
index 077aca6bcd39caa5dd4575494dbcd212a486fa8f..e481fc0f9a0ae4f36044fb4dedba2ff7de2bf062 100644 (file)
@@ -59,6 +59,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.ei
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.authkey.container.MappingAuthkey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.transport.address.TransportAddress;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.db.instance.AuthenticationKey;
+import org.opendaylight.yangtools.concepts.Registration;
 import org.opendaylight.yangtools.yang.binding.Notification;
 import org.osgi.service.component.annotations.Activate;
 import org.osgi.service.component.annotations.Component;
@@ -121,6 +122,7 @@ public class LispSouthboundPlugin implements IConfigLispSouthboundPlugin, AutoCl
     private EventLoopGroup eventLoopGroup;
     private AuthenticationKeyDataListener authenticationKeyDataListener;
     private DataStoreBackEnd dsbe;
+    private Registration cssReg;
 
     @Inject
     public LispSouthboundPlugin(final DataBroker dataBroker,
@@ -194,7 +196,7 @@ public class LispSouthboundPlugin implements IConfigLispSouthboundPlugin, AutoCl
             start();
             startXtr();
 
-            clusterSingletonService.registerClusterSingletonService(this);
+            cssReg = clusterSingletonService.registerClusterSingletonService(this);
         }
 
         LOG.info("LISP (RFC6830) Southbound Plugin is up!");
@@ -379,7 +381,9 @@ public class LispSouthboundPlugin implements IConfigLispSouthboundPlugin, AutoCl
         eventLoopGroup.shutdownGracefully();
         lispSouthboundHandler.close();
         unloadActions();
-        clusterSingletonService.close();
+        if (cssReg != null) {
+            cssReg.close();
+        }
         dsbe.closeTransactionChain();
     }