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 17663d9..0aae75d 100644 (file)
@@ -7,15 +7,7 @@
  */
 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 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 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
@@ -274,10 +271,5 @@ public abstract class AbstractDispatcher<S extends ProtocolSession<?>, L extends
     @Deprecated
     @Override
     public void close() {
-        try {
-            this.workerGroup.shutdownGracefully();
-        } finally {
-            this.bossGroup.shutdownGracefully();
-        }
     }
 }
index e274b05..281b76c 100644 (file)
@@ -32,6 +32,7 @@ module netty {
 
         base "config:service-type";
         config:java-class "io.netty.channel.EventLoopGroup";
+        config:disable-osgi-service-registration;
     }
 
     identity netty-event-executor {
@@ -40,6 +41,7 @@ module netty {
 
         base "config:service-type";
         config:java-class "io.netty.util.concurrent.EventExecutor";
+        config:disable-osgi-service-registration;
     }
 
     identity netty-timer {
@@ -48,6 +50,7 @@ module netty {
 
         base "config:service-type";
         config:java-class "io.netty.util.Timer";
+        config:disable-osgi-service-registration;
     }
 
     identity channel-factory {
@@ -56,5 +59,6 @@ module netty {
 
         base "config:service-type";
         config:java-class "io.netty.bootstrap.ChannelFactory";
+        config:disable-osgi-service-registration;
     }
 }
index 527b043..bfb088f 100644 (file)
     <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>
 
-  <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>
index 60822d5..cd897be 100644 (file)
     <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>