From 3341ac467cc08ac95f937945c7502ac4a019d805 Mon Sep 17 00:00:00 2001 From: Maros Marsalek Date: Wed, 17 Aug 2016 15:38:01 +0200 Subject: Make Restconf thread pools configurable Change-Id: Ie03a1fde5181cfd8457e36d67afc2cc0c69c1e1d Signed-off-by: Maros Marsalek --- .../distro/netconf/HoneycombNotification2NetconfProvider.groovy | 4 ++-- .../infra/distro/netconf/NetconfSshServerProvider.groovy | 8 +++++--- .../infra/distro/netconf/NettyThreadGroupProvider.groovy | 9 ++++----- 3 files changed, 11 insertions(+), 10 deletions(-) (limited to 'infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/netconf') diff --git a/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/netconf/HoneycombNotification2NetconfProvider.groovy b/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/netconf/HoneycombNotification2NetconfProvider.groovy index 7e4453ef1..f8c9aaae3 100644 --- a/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/netconf/HoneycombNotification2NetconfProvider.groovy +++ b/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/netconf/HoneycombNotification2NetconfProvider.groovy @@ -52,13 +52,13 @@ class HoneycombNotification2NetconfProvider extends ProviderTrait diff --git a/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/netconf/NetconfSshServerProvider.groovy b/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/netconf/NetconfSshServerProvider.groovy index bce4f261a..8b1b5bec2 100644 --- a/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/netconf/NetconfSshServerProvider.groovy +++ b/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/netconf/NetconfSshServerProvider.groovy @@ -16,6 +16,7 @@ package io.fd.honeycomb.infra.distro.netconf +import com.google.common.util.concurrent.ThreadFactoryBuilder import com.google.inject.Inject import groovy.transform.ToString import groovy.util.logging.Slf4j @@ -48,12 +49,13 @@ class NetconfSshServerProvider extends ProviderTrait { NioEventLoopGroup nettyThreadgroup // TODO merge with other executors .. one of the brokers creates also 2 internal executors - private ScheduledExecutorService pool = Executors.newScheduledThreadPool(1) + private ScheduledExecutorService pool = + Executors.newScheduledThreadPool(1, new ThreadFactoryBuilder().setNameFormat("netconf-ssh-%d").build()) @Override def create() { - def name = InetAddress.getByName(cfgAttributes.netconfSshBindingAddress) - def bindingAddress = new InetSocketAddress(name, cfgAttributes.netconfSshBindingPort) + def name = InetAddress.getByName(cfgAttributes.netconfSshBindingAddress.get()) + def bindingAddress = new InetSocketAddress(name, cfgAttributes.netconfSshBindingPort.get()) def localAddress = new LocalAddress(cfgAttributes.netconfSshBindingPort.toString()) def localServer = dispatcher.createLocalServer(localAddress) diff --git a/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/netconf/NettyThreadGroupProvider.groovy b/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/netconf/NettyThreadGroupProvider.groovy index da5f3d5b2..bff8e3d8e 100644 --- a/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/netconf/NettyThreadGroupProvider.groovy +++ b/infra/minimal-distribution/src/main/java/io/fd/honeycomb/infra/distro/netconf/NettyThreadGroupProvider.groovy @@ -16,13 +16,13 @@ package io.fd.honeycomb.infra.distro.netconf +import com.google.common.util.concurrent.ThreadFactoryBuilder import com.google.inject.Inject import groovy.transform.ToString import groovy.util.logging.Slf4j -import io.fd.honeycomb.infra.distro.cfgattrs.HoneycombConfiguration import io.fd.honeycomb.infra.distro.ProviderTrait +import io.fd.honeycomb.infra.distro.cfgattrs.HoneycombConfiguration import io.netty.channel.nio.NioEventLoopGroup - /** * Mirror of org.opendaylight.controller.config.yang.netty.threadgroup.NettyThreadgroupModule */ @@ -35,8 +35,7 @@ class NettyThreadGroupProvider extends ProviderTrait { @Override def create() { - cfgAttributes.netconfNettyThreads.isPresent() ? - new NioEventLoopGroup(cfgAttributes.netconfNettyThreads.get()) : - new NioEventLoopGroup() + new NioEventLoopGroup(cfgAttributes.netconfNettyThreads, + new ThreadFactoryBuilder().setNameFormat("netconf-netty-%d").build()) } } -- cgit 1.2.3-korg