Clustering - adding to LispSouthboundPlugin.
[lispflowmapping.git] / mappingservice / southbound / src / main / java / org / opendaylight / lispflowmapping / southbound / lisp / LispSouthboundHandler.java
index 1ac782723c57f2f48f6256600bafca2abdba693e..2b4cef6af38fd0d26f9b5047fd585575544ca3c7 100644 (file)
@@ -100,6 +100,7 @@ public class LispSouthboundHandler extends SimpleChannelInboundHandler<DatagramP
     private SimpleMapCache smc;
     private AuthenticationKeyDataListener authenticationKeyDataListener;
     private DataStoreBackEnd dsbe;
+    private boolean isReadFromChannelEnabled = true;
 
     public LispSouthboundHandler(LispSouthboundPlugin lispSbPlugin) {
         this.lispSbPlugin = lispSbPlugin;
@@ -504,11 +505,13 @@ public class LispSouthboundHandler extends SimpleChannelInboundHandler<DatagramP
 
     @Override
     protected void channelRead0(ChannelHandlerContext ctx, DatagramPacket msg) throws Exception {
-        if (LOG.isTraceEnabled()) {
-            LOG.trace("Received UDP packet from {}:{} with content:\n{}", msg.sender().getHostString(),
-                    msg.sender().getPort(), ByteBufUtil.prettyHexDump(msg.content()));
+        if (isReadFromChannelEnabled) {
+            if (LOG.isTraceEnabled()) {
+                LOG.trace("Received UDP packet from {}:{} with content:\n{}", msg.sender().getHostString(),
+                        msg.sender().getPort(), ByteBufUtil.prettyHexDump(msg.content()));
+            }
+            handlePacket(msg);
         }
-        handlePacket(msg);
     }
 
     @Override
@@ -569,4 +572,8 @@ public class LispSouthboundHandler extends SimpleChannelInboundHandler<DatagramP
         this.authenticationKeyDataListener = new AuthenticationKeyDataListener(dataBroker, smc);
         dsbe = new DataStoreBackEnd(dataBroker);
     }
+
+    public void setIsReadFromChannelEnabled(boolean isReadFromChannelEnabled) {
+        this.isReadFromChannelEnabled = isReadFromChannelEnabled;
+    }
 }