NettyMessagingManager: assign thread names
- Assign names to the thread used in the event loop
Change-Id: I5446801c3113ef4ca3b887346a07dda66a84638b
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 239b43b..a752527 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
@@ -83,6 +83,7 @@
import java.util.function.BiFunction;
import java.util.function.Consumer;
+import static org.onlab.util.Tools.groupedThreads;
import static org.onosproject.security.AppGuard.checkPermission;
import static org.onosproject.security.AppPermission.Type.CLUSTER_WRITE;
@@ -121,7 +122,7 @@
.build();
private final GenericKeyedObjectPool<Endpoint, Connection> channels
- = new GenericKeyedObjectPool<Endpoint, Connection>(new OnosCommunicationChannelFactory());
+ = new GenericKeyedObjectPool<>(new OnosCommunicationChannelFactory());
private EventLoopGroup serverGroup;
private EventLoopGroup clientGroup;
@@ -203,8 +204,8 @@
private void initEventLoopGroup() {
// try Epoll first and if that does work, use nio.
try {
- clientGroup = new EpollEventLoopGroup();
- serverGroup = new EpollEventLoopGroup();
+ clientGroup = new EpollEventLoopGroup(0, groupedThreads("NettyMessagingEvt", "epollC-%d", log));
+ serverGroup = new EpollEventLoopGroup(0, groupedThreads("NettyMessagingEvt", "epollS-%d", log));
serverChannelClass = EpollServerSocketChannel.class;
clientChannelClass = EpollSocketChannel.class;
return;
@@ -212,8 +213,8 @@
log.debug("Failed to initialize native (epoll) transport. "
+ "Reason: {}. Proceeding with nio.", e.getMessage());
}
- clientGroup = new NioEventLoopGroup();
- serverGroup = new NioEventLoopGroup();
+ clientGroup = new NioEventLoopGroup(0, groupedThreads("NettyMessagingEvt", "nioC-%d", log));
+ serverGroup = new NioEventLoopGroup(0, groupedThreads("NettyMessagingEvt", "nioS-%d", log));
serverChannelClass = NioServerSocketChannel.class;
clientChannelClass = NioSocketChannel.class;
}