Yuta HIGUCHI

Give a name to each ThreadPool

Change-Id: Iec2b044fca542672608fd67ff43680f0d34b9da2
......@@ -16,6 +16,7 @@
package org.onlab.onos.sdnip.bgp;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.onlab.util.Tools.namedThreads;
import java.net.InetAddress;
import java.net.InetSocketAddress;
......@@ -186,8 +187,8 @@ public class BgpSessionManager {
isShutdown = false;
ChannelFactory channelFactory =
new NioServerSocketChannelFactory(Executors.newCachedThreadPool(),
Executors.newCachedThreadPool());
new NioServerSocketChannelFactory(Executors.newCachedThreadPool(namedThreads("BGP-SM-boss-%d")),
Executors.newCachedThreadPool(namedThreads("BGP-SM-worker-%d")));
ChannelPipelineFactory pipelineFactory = new ChannelPipelineFactory() {
@Override
public ChannelPipeline getPipeline() throws Exception {
......
......@@ -16,6 +16,8 @@
package org.onlab.onos.openflow.controller.impl;
import static org.onlab.util.Tools.namedThreads;
import java.lang.management.ManagementFactory;
import java.lang.management.RuntimeMXBean;
import java.net.InetSocketAddress;
......@@ -135,13 +137,13 @@ public class Controller {
if (workerThreads == 0) {
execFactory = new NioServerSocketChannelFactory(
Executors.newCachedThreadPool(),
Executors.newCachedThreadPool());
Executors.newCachedThreadPool(namedThreads("Controller-boss-%d")),
Executors.newCachedThreadPool(namedThreads("Controller-worker-%d")));
return new ServerBootstrap(execFactory);
} else {
execFactory = new NioServerSocketChannelFactory(
Executors.newCachedThreadPool(),
Executors.newCachedThreadPool(), workerThreads);
Executors.newCachedThreadPool(namedThreads("Controller-boss-%d")),
Executors.newCachedThreadPool(namedThreads("Controller-worker-%d")), workerThreads);
return new ServerBootstrap(execFactory);
}
}
......