Merge "Resolve Bug:707 - ConfigPusher should wait for netconf-impl to register JMX...
[controller.git] / opendaylight / netconf / netconf-impl / src / main / java / org / opendaylight / controller / netconf / impl / NetconfServerDispatcher.java
index bd39049c562fe8300fcccb053ec168adc02ad6f5..ee9009762e8cda9d3f2ac8896f2df8bced568f83 100644 (file)
@@ -41,6 +41,8 @@ public class NetconfServerDispatcher extends AbstractDispatcher<NetconfServerSes
 
     public static class ServerChannelInitializer extends AbstractChannelInitializer<NetconfServerSession> {
 
+        public static final String DESERIALIZER_EX_HANDLER_KEY = "deserializerExHandler";
+
         private final NetconfServerSessionNegotiatorFactory negotiatorFactory;
         private final NetconfServerSessionListenerFactory listenerFactory;
 
@@ -51,9 +53,14 @@ public class NetconfServerDispatcher extends AbstractDispatcher<NetconfServerSes
         }
 
         @Override
-        protected void initializeAfterDecoder(SocketChannel ch, Promise<NetconfServerSession> promise) {
-            ch.pipeline().addLast("deserializerExHandler", new DeserializerExceptionHandler());
-            ch.pipeline().addLast("negotiator", negotiatorFactory.getSessionNegotiator(listenerFactory, ch, promise));
+        protected void initializeMessageDecoder(SocketChannel ch) {
+            super.initializeMessageDecoder(ch);
+            ch.pipeline().addLast(DESERIALIZER_EX_HANDLER_KEY, new DeserializerExceptionHandler());
+        }
+
+        @Override
+        protected void initializeSessionNegotiator(SocketChannel ch, Promise<NetconfServerSession> promise) {
+            ch.pipeline().addAfter(DESERIALIZER_EX_HANDLER_KEY, AbstractChannelInitializer.NETCONF_SESSION_NEGOTIATOR, negotiatorFactory.getSessionNegotiator(listenerFactory, ch, promise));
         }
     }