Revisiting netty configurations

- Revisiting netty configuration based on:
-- http://normanmaurer.me/presentations/2014-facebook-eng-netty/slides.html#11.0
-- http://normanmaurer.me/presentations/2014-facebook-eng-netty/slides.html#14.0

Change-Id: I6fe5586908ce2b7c87fd00c8f9da6cca3d907d10
diff --git a/core/store/dist/src/main/java/org/onosproject/store/cluster/messaging/impl/NettyMessagingManager.java b/core/store/dist/src/main/java/org/onosproject/store/cluster/messaging/impl/NettyMessagingManager.java
index a806c02..e9b50c4 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/cluster/messaging/impl/NettyMessagingManager.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/cluster/messaging/impl/NettyMessagingManager.java
@@ -248,7 +248,9 @@
                 connection = channels.borrowObject(ep);
                 connection.send(message, future);
             } finally {
-                channels.returnObject(ep, connection);
+                if (connection != null) {
+                    channels.returnObject(ep, connection);
+                }
             }
         } catch (Exception e) {
             future.completeExceptionally(e);
@@ -322,11 +324,11 @@
 
     private void startAcceptingConnections() throws InterruptedException {
         ServerBootstrap b = new ServerBootstrap();
-        b.option(ChannelOption.WRITE_BUFFER_HIGH_WATER_MARK, 32 * 1024);
-        b.option(ChannelOption.WRITE_BUFFER_LOW_WATER_MARK, 8 * 1024);
+        b.childOption(ChannelOption.WRITE_BUFFER_HIGH_WATER_MARK, 32 * 1024);
+        b.childOption(ChannelOption.WRITE_BUFFER_LOW_WATER_MARK, 8 * 1024);
         b.option(ChannelOption.SO_RCVBUF, 1048576);
         b.option(ChannelOption.TCP_NODELAY, true);
-        b.option(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT);
+        b.childOption(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT);
         b.group(serverGroup, clientGroup);
         b.channel(serverChannelClass);
         if (enableNettyTls) {