Enable netty config modules to restart when blueprint container restarts 80/38280/6
authorTom Pantelis <tpanteli@brocade.com>
Tue, 19 Apr 2016 05:09:39 +0000 (01:09 -0400)
committerTom Pantelis <tpanteli@brocade.com>
Wed, 15 Jun 2016 22:47:36 +0000 (18:47 -0400)
Added the necessary service properties such that when the blueprint
container is restarted on config change the associated config system
Module instances are recreated/restarted. This for backwards compatibility
for existing CSS modules that inject the netty CSS modules.

Change-Id: Icb12968805d8760cb03d3eea1e8ceda5ec1de2f5
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
opendaylight/commons/protocol-framework/src/main/java/org/opendaylight/protocol/framework/AbstractDispatcher.java
opendaylight/config/netty-config-api/src/main/yang/netty.yang
opendaylight/config/netty-threadgroup-config/src/main/resources/org/opendaylight/blueprint/netty-threadgroup.xml
opendaylight/config/netty-timer-config/src/main/resources/org/opendaylight/blueprint/netty-timer.xml

index 17663d982c5e188f7c898f9575571fb478e61bc5..0aae75deddb88938d70f53453e813dd2a1e68e54 100644 (file)
@@ -7,15 +7,7 @@
  */
 package org.opendaylight.protocol.framework;
 
  */
 package org.opendaylight.protocol.framework;
 
-import java.io.Closeable;
-import java.net.InetSocketAddress;
-import java.net.SocketAddress;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
 import com.google.common.base.Preconditions;
 import com.google.common.base.Preconditions;
-
 import io.netty.bootstrap.Bootstrap;
 import io.netty.bootstrap.ServerBootstrap;
 import io.netty.buffer.PooledByteBufAllocator;
 import io.netty.bootstrap.Bootstrap;
 import io.netty.bootstrap.ServerBootstrap;
 import io.netty.buffer.PooledByteBufAllocator;
@@ -34,6 +26,11 @@ import io.netty.util.concurrent.EventExecutor;
 import io.netty.util.concurrent.Future;
 import io.netty.util.concurrent.GlobalEventExecutor;
 import io.netty.util.concurrent.Promise;
 import io.netty.util.concurrent.Future;
 import io.netty.util.concurrent.GlobalEventExecutor;
 import io.netty.util.concurrent.Promise;
+import java.io.Closeable;
+import java.net.InetSocketAddress;
+import java.net.SocketAddress;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * Dispatcher class for creating servers and clients. The idea is to first create servers and clients and the run the
 
 /**
  * Dispatcher class for creating servers and clients. The idea is to first create servers and clients and the run the
@@ -274,10 +271,5 @@ public abstract class AbstractDispatcher<S extends ProtocolSession<?>, L extends
     @Deprecated
     @Override
     public void close() {
     @Deprecated
     @Override
     public void close() {
-        try {
-            this.workerGroup.shutdownGracefully();
-        } finally {
-            this.bossGroup.shutdownGracefully();
-        }
     }
 }
     }
 }
index e274b058dccce43045ac6647d9c8775e65ceb78f..281b76c1b84900b8fa0eb613da39547a16ebe0e8 100644 (file)
@@ -32,6 +32,7 @@ module netty {
 
         base "config:service-type";
         config:java-class "io.netty.channel.EventLoopGroup";
 
         base "config:service-type";
         config:java-class "io.netty.channel.EventLoopGroup";
+        config:disable-osgi-service-registration;
     }
 
     identity netty-event-executor {
     }
 
     identity netty-event-executor {
@@ -40,6 +41,7 @@ module netty {
 
         base "config:service-type";
         config:java-class "io.netty.util.concurrent.EventExecutor";
 
         base "config:service-type";
         config:java-class "io.netty.util.concurrent.EventExecutor";
+        config:disable-osgi-service-registration;
     }
 
     identity netty-timer {
     }
 
     identity netty-timer {
@@ -48,6 +50,7 @@ module netty {
 
         base "config:service-type";
         config:java-class "io.netty.util.Timer";
 
         base "config:service-type";
         config:java-class "io.netty.util.Timer";
+        config:disable-osgi-service-registration;
     }
 
     identity channel-factory {
     }
 
     identity channel-factory {
@@ -56,5 +59,6 @@ module netty {
 
         base "config:service-type";
         config:java-class "io.netty.bootstrap.ChannelFactory";
 
         base "config:service-type";
         config:java-class "io.netty.bootstrap.ChannelFactory";
+        config:disable-osgi-service-registration;
     }
 }
     }
 }
index 527b04303a2b75ca36c74c79936752f07ee1411d..bfb088f765e99f49921b8f090cc1818f1da5bef4 100644 (file)
     <argument value="${global-boss-group-thread-count}"/>
   </bean>
 
     <argument value="${global-boss-group-thread-count}"/>
   </bean>
 
-  <service ref="globalBossGroup" interface="io.netty.channel.EventLoopGroup" odl:type="global-boss-group"/>
+  <service ref="globalBossGroup" interface="io.netty.channel.EventLoopGroup" odl:type="global-boss-group">
+  <service-properties>
+      <entry key="config-module-namespace" value="urn:opendaylight:params:xml:ns:yang:controller:netty:threadgroup"/>
+      <entry key="config-module-name" value="netty-threadgroup-fixed"/>
+      <entry key="config-instance-name" value="global-boss-group"/>
+    </service-properties>
+  </service>
 
   <bean id="globalWorkerGroup" class="org.opendaylight.controller.config.yang.netty.threadgroup.NioEventLoopGroupCloseable"
           factory-method="newInstance">
     <argument value="${global-worker-group-thread-count}"/>
   </bean>
 
 
   <bean id="globalWorkerGroup" class="org.opendaylight.controller.config.yang.netty.threadgroup.NioEventLoopGroupCloseable"
           factory-method="newInstance">
     <argument value="${global-worker-group-thread-count}"/>
   </bean>
 
-  <service ref="globalWorkerGroup" interface="io.netty.channel.EventLoopGroup" odl:type="global-worker-group"/>
+  <service ref="globalWorkerGroup" interface="io.netty.channel.EventLoopGroup" odl:type="global-worker-group">
+  <service-properties>
+      <entry key="config-module-namespace" value="urn:opendaylight:params:xml:ns:yang:controller:netty:threadgroup"/>
+      <entry key="config-module-name" value="netty-threadgroup-fixed"/>
+      <entry key="config-instance-name" value="global-worker-group"/>
+    </service-properties>
+  </service>
 
 </blueprint>
 
 </blueprint>
index 60822d504ede7811f56b77305c9071ce6161172b..cd897be515b30cbf43871bfcab060f956b1d5235 100644 (file)
     <argument value="${ticks-per-wheel}"/>
   </bean>
 
     <argument value="${ticks-per-wheel}"/>
   </bean>
 
-  <service ref="timer" interface="io.netty.util.Timer" odl:type="global-timer"/>
+  <service ref="timer" interface="io.netty.util.Timer" odl:type="global-timer">
+    <service-properties>
+      <entry key="config-module-namespace" value="urn:opendaylight:params:xml:ns:yang:controller:netty:timer"/>
+      <entry key="config-module-name" value="netty-hashed-wheel-timer"/>
+      <entry key="config-instance-name" value="global-timer"/>
+    </service-properties>
+  </service>
 
 </blueprint>
 
 </blueprint>