(
NettyChannelBuilder builder, Transport transport, int flowControlWindow)
| 123 | } |
| 124 | |
| 125 | private static NettyChannelBuilder configureNetty( |
| 126 | NettyChannelBuilder builder, Transport transport, int flowControlWindow) { |
| 127 | builder.flowControlWindow(flowControlWindow); |
| 128 | DefaultThreadFactory tf = new DefaultThreadFactory("client-elg-", true /*daemon */); |
| 129 | switch (transport) { |
| 130 | case NETTY_NIO: |
| 131 | builder |
| 132 | .eventLoopGroup(new NioEventLoopGroup(0, tf)) |
| 133 | .channelType(NioSocketChannel.class, InetSocketAddress.class); |
| 134 | break; |
| 135 | |
| 136 | case NETTY_EPOLL: |
| 137 | // These classes only work on Linux. |
| 138 | builder |
| 139 | .eventLoopGroup(new EpollEventLoopGroup(0, tf)) |
| 140 | .channelType(EpollSocketChannel.class, InetSocketAddress.class); |
| 141 | break; |
| 142 | |
| 143 | case NETTY_UNIX_DOMAIN_SOCKET: |
| 144 | // These classes only work on Linux. |
| 145 | builder |
| 146 | .eventLoopGroup(new EpollEventLoopGroup(0, tf)) |
| 147 | .channelType(EpollDomainSocketChannel.class, DomainSocketAddress.class); |
| 148 | break; |
| 149 | |
| 150 | default: |
| 151 | // Should never get here. |
| 152 | throw new IllegalArgumentException("Unsupported transport: " + transport); |
| 153 | } |
| 154 | return builder; |
| 155 | } |
| 156 | |
| 157 | private static ExecutorService clientExecutor; |
| 158 |
no test coverage detected