Give a name to each ThreadPool
Change-Id: Iec2b044fca542672608fd67ff43680f0d34b9da2
Showing
2 changed files
with
9 additions
and
6 deletions
| ... | @@ -16,6 +16,7 @@ | ... | @@ -16,6 +16,7 @@ |
| 16 | package org.onlab.onos.sdnip.bgp; | 16 | package org.onlab.onos.sdnip.bgp; |
| 17 | 17 | ||
| 18 | import static com.google.common.base.Preconditions.checkNotNull; | 18 | import static com.google.common.base.Preconditions.checkNotNull; |
| 19 | +import static org.onlab.util.Tools.namedThreads; | ||
| 19 | 20 | ||
| 20 | import java.net.InetAddress; | 21 | import java.net.InetAddress; |
| 21 | import java.net.InetSocketAddress; | 22 | import java.net.InetSocketAddress; |
| ... | @@ -186,8 +187,8 @@ public class BgpSessionManager { | ... | @@ -186,8 +187,8 @@ public class BgpSessionManager { |
| 186 | isShutdown = false; | 187 | isShutdown = false; |
| 187 | 188 | ||
| 188 | ChannelFactory channelFactory = | 189 | ChannelFactory channelFactory = |
| 189 | - new NioServerSocketChannelFactory(Executors.newCachedThreadPool(), | 190 | + new NioServerSocketChannelFactory(Executors.newCachedThreadPool(namedThreads("BGP-SM-boss-%d")), |
| 190 | - Executors.newCachedThreadPool()); | 191 | + Executors.newCachedThreadPool(namedThreads("BGP-SM-worker-%d"))); |
| 191 | ChannelPipelineFactory pipelineFactory = new ChannelPipelineFactory() { | 192 | ChannelPipelineFactory pipelineFactory = new ChannelPipelineFactory() { |
| 192 | @Override | 193 | @Override |
| 193 | public ChannelPipeline getPipeline() throws Exception { | 194 | public ChannelPipeline getPipeline() throws Exception { | ... | ... |
| ... | @@ -16,6 +16,8 @@ | ... | @@ -16,6 +16,8 @@ |
| 16 | 16 | ||
| 17 | package org.onlab.onos.openflow.controller.impl; | 17 | package org.onlab.onos.openflow.controller.impl; |
| 18 | 18 | ||
| 19 | +import static org.onlab.util.Tools.namedThreads; | ||
| 20 | + | ||
| 19 | import java.lang.management.ManagementFactory; | 21 | import java.lang.management.ManagementFactory; |
| 20 | import java.lang.management.RuntimeMXBean; | 22 | import java.lang.management.RuntimeMXBean; |
| 21 | import java.net.InetSocketAddress; | 23 | import java.net.InetSocketAddress; |
| ... | @@ -135,13 +137,13 @@ public class Controller { | ... | @@ -135,13 +137,13 @@ public class Controller { |
| 135 | 137 | ||
| 136 | if (workerThreads == 0) { | 138 | if (workerThreads == 0) { |
| 137 | execFactory = new NioServerSocketChannelFactory( | 139 | execFactory = new NioServerSocketChannelFactory( |
| 138 | - Executors.newCachedThreadPool(), | 140 | + Executors.newCachedThreadPool(namedThreads("Controller-boss-%d")), |
| 139 | - Executors.newCachedThreadPool()); | 141 | + Executors.newCachedThreadPool(namedThreads("Controller-worker-%d"))); |
| 140 | return new ServerBootstrap(execFactory); | 142 | return new ServerBootstrap(execFactory); |
| 141 | } else { | 143 | } else { |
| 142 | execFactory = new NioServerSocketChannelFactory( | 144 | execFactory = new NioServerSocketChannelFactory( |
| 143 | - Executors.newCachedThreadPool(), | 145 | + Executors.newCachedThreadPool(namedThreads("Controller-boss-%d")), |
| 144 | - Executors.newCachedThreadPool(), workerThreads); | 146 | + Executors.newCachedThreadPool(namedThreads("Controller-worker-%d")), workerThreads); |
| 145 | return new ServerBootstrap(execFactory); | 147 | return new ServerBootstrap(execFactory); |
| 146 | } | 148 | } |
| 147 | } | 149 | } | ... | ... |
-
Please register or login to post a comment