Committed by
Yuta HIGUCHI
NettyMessagingManager: assign thread names
- Assign names to the thread used in the event loop Change-Id: I5446801c3113ef4ca3b887346a07dda66a84638b
Showing
1 changed file
with
6 additions
and
5 deletions
... | @@ -83,6 +83,7 @@ import java.util.function.BiConsumer; | ... | @@ -83,6 +83,7 @@ import java.util.function.BiConsumer; |
83 | import java.util.function.BiFunction; | 83 | import java.util.function.BiFunction; |
84 | import java.util.function.Consumer; | 84 | import java.util.function.Consumer; |
85 | 85 | ||
86 | +import static org.onlab.util.Tools.groupedThreads; | ||
86 | import static org.onosproject.security.AppGuard.checkPermission; | 87 | import static org.onosproject.security.AppGuard.checkPermission; |
87 | import static org.onosproject.security.AppPermission.Type.CLUSTER_WRITE; | 88 | import static org.onosproject.security.AppPermission.Type.CLUSTER_WRITE; |
88 | 89 | ||
... | @@ -121,7 +122,7 @@ public class NettyMessagingManager implements MessagingService { | ... | @@ -121,7 +122,7 @@ public class NettyMessagingManager implements MessagingService { |
121 | .build(); | 122 | .build(); |
122 | 123 | ||
123 | private final GenericKeyedObjectPool<Endpoint, Connection> channels | 124 | private final GenericKeyedObjectPool<Endpoint, Connection> channels |
124 | - = new GenericKeyedObjectPool<Endpoint, Connection>(new OnosCommunicationChannelFactory()); | 125 | + = new GenericKeyedObjectPool<>(new OnosCommunicationChannelFactory()); |
125 | 126 | ||
126 | private EventLoopGroup serverGroup; | 127 | private EventLoopGroup serverGroup; |
127 | private EventLoopGroup clientGroup; | 128 | private EventLoopGroup clientGroup; |
... | @@ -203,8 +204,8 @@ public class NettyMessagingManager implements MessagingService { | ... | @@ -203,8 +204,8 @@ public class NettyMessagingManager implements MessagingService { |
203 | private void initEventLoopGroup() { | 204 | private void initEventLoopGroup() { |
204 | // try Epoll first and if that does work, use nio. | 205 | // try Epoll first and if that does work, use nio. |
205 | try { | 206 | try { |
206 | - clientGroup = new EpollEventLoopGroup(); | 207 | + clientGroup = new EpollEventLoopGroup(0, groupedThreads("NettyMessagingEvt", "epollC-%d", log)); |
207 | - serverGroup = new EpollEventLoopGroup(); | 208 | + serverGroup = new EpollEventLoopGroup(0, groupedThreads("NettyMessagingEvt", "epollS-%d", log)); |
208 | serverChannelClass = EpollServerSocketChannel.class; | 209 | serverChannelClass = EpollServerSocketChannel.class; |
209 | clientChannelClass = EpollSocketChannel.class; | 210 | clientChannelClass = EpollSocketChannel.class; |
210 | return; | 211 | return; |
... | @@ -212,8 +213,8 @@ public class NettyMessagingManager implements MessagingService { | ... | @@ -212,8 +213,8 @@ public class NettyMessagingManager implements MessagingService { |
212 | log.debug("Failed to initialize native (epoll) transport. " | 213 | log.debug("Failed to initialize native (epoll) transport. " |
213 | + "Reason: {}. Proceeding with nio.", e.getMessage()); | 214 | + "Reason: {}. Proceeding with nio.", e.getMessage()); |
214 | } | 215 | } |
215 | - clientGroup = new NioEventLoopGroup(); | 216 | + clientGroup = new NioEventLoopGroup(0, groupedThreads("NettyMessagingEvt", "nioC-%d", log)); |
216 | - serverGroup = new NioEventLoopGroup(); | 217 | + serverGroup = new NioEventLoopGroup(0, groupedThreads("NettyMessagingEvt", "nioS-%d", log)); |
217 | serverChannelClass = NioServerSocketChannel.class; | 218 | serverChannelClass = NioServerSocketChannel.class; |
218 | clientChannelClass = NioSocketChannel.class; | 219 | clientChannelClass = NioSocketChannel.class; |
219 | } | 220 | } | ... | ... |
-
Please register or login to post a comment