mirror of https://github.com/grpc/grpc-java.git
netty: make default number of event loops defer to netty
This commit is contained in:
parent
62b03fd7e6
commit
21141cc837
|
|
@ -176,7 +176,7 @@ class Utils {
|
|||
return s;
|
||||
}
|
||||
|
||||
private static class DefaultEventLoopGroupResource implements Resource<EventLoopGroup> {
|
||||
private static final class DefaultEventLoopGroupResource implements Resource<EventLoopGroup> {
|
||||
private final String name;
|
||||
private final int numEventLoops;
|
||||
|
||||
|
|
@ -188,11 +188,8 @@ class Utils {
|
|||
@Override
|
||||
public EventLoopGroup create() {
|
||||
// Use Netty's DefaultThreadFactory in order to get the benefit of FastThreadLocal.
|
||||
boolean useDaemonThreads = true;
|
||||
ThreadFactory threadFactory = new DefaultThreadFactory(name, useDaemonThreads);
|
||||
int parallelism = numEventLoops == 0
|
||||
? Runtime.getRuntime().availableProcessors() * 2 : numEventLoops;
|
||||
return new NioEventLoopGroup(parallelism, threadFactory);
|
||||
ThreadFactory threadFactory = new DefaultThreadFactory(name, /* daemon= */ true);
|
||||
return new NioEventLoopGroup(numEventLoops, threadFactory);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Reference in New Issue