Don't restart plugin if its already up TELSDN-564 59/2659/1
authorGuy Sela <guy.sela@contextream.com>
Mon, 11 Nov 2013 19:23:33 +0000 (21:23 +0200)
committerGuy Sela <guy.sela@contextream.com>
Mon, 11 Nov 2013 19:44:08 +0000 (21:44 +0200)
Change-Id: I3de034a685e375fe23a71d5585b7f603c0e0848f
Signed-off-by: Guy Sela <guy.sela@contextream.com>
mappingservice/southbound/src/main/java/org/opendaylight/lispflowmapping/southbound/LispSouthboundPlugin.java

index 356dc5b88263c5237b82e45034963818ad4ef1ea..b4ec63de9ac3f4f798f6f5c5dfd7044426b0ea3a 100644 (file)
@@ -57,13 +57,13 @@ public class LispSouthboundPlugin extends AbstractBindingAwareProvider implement
         if (thread != null) {
             thread.stopRunning();
         }
+        lispSouthboundService = null;
+        thread = null;
         logger.info("LISP (RFC6830) Mapping Service is down!");
         try {
             Thread.sleep(1100);
         } catch (InterruptedException e) {
         }
-        lispSouthboundService = null;
-        thread = null;
     }
 
     public void destroy() {
@@ -141,18 +141,20 @@ public class LispSouthboundPlugin extends AbstractBindingAwareProvider implement
     }
 
     public void onSessionInitiated(ProviderContext session) {
-        lispSouthboundService = new LispSouthboundService();
-        thread = new LispIoThread();
-        logger.info("LISP (RFC6830) Mapping Service is up!");
-        thread.start();
+        if (thread == null) {
+            lispSouthboundService = new LispSouthboundService();
+            thread = new LispIoThread();
+            logger.info("LISP (RFC6830) Mapping Service is up!");
+            thread.start();
 
-        // OSGI console
-        registerWithOSGIConsole();
+            // OSGI console
+            registerWithOSGIConsole();
 
-        logger.debug("Provider Session initialized");
+            logger.debug("Provider Session initialized");
 
-        lispSouthboundService.setNotificationProvider(session.getSALService(NotificationProviderService.class));
-        session.addRpcImplementation(ILispSouthboundPlugin.class, this);
+            lispSouthboundService.setNotificationProvider(session.getSALService(NotificationProviderService.class));
+            session.addRpcImplementation(ILispSouthboundPlugin.class, this);
+        }
     }
 
     public Future<RpcResult<Void>> handleMapNotify(MapNotify mapNotify, InetAddress address) {