Use Netty thread factory to take advantage of FastThreadLocal

This should reduce CPU usage slightly.
This commit is contained in:
Andrew Steinborn
2019-07-02 02:19:52 -04:00
parent c0becce276
commit dab9c9a382
2 changed files with 9 additions and 6 deletions

View File

@@ -19,6 +19,7 @@ import io.netty.channel.socket.SocketChannel;
import io.netty.channel.socket.nio.NioDatagramChannel;
import io.netty.channel.socket.nio.NioServerSocketChannel;
import io.netty.channel.socket.nio.NioSocketChannel;
import io.netty.util.concurrent.DefaultThreadFactory;
import java.util.concurrent.ThreadFactory;
import java.util.function.BiFunction;
@@ -60,10 +61,7 @@ enum TransportType {
}
private static ThreadFactory createThreadFactory(final String name, final Type type) {
return new ThreadFactoryBuilder()
.setNameFormat("Netty " + name + ' ' + type.toString() + " #%d")
.setDaemon(true)
.build();
return new DefaultThreadFactory("Netty " + name + ' ' + type.toString(), false);
}
public static TransportType bestType() {