jojochuang commented on a change in pull request #2832:
URL: https://github.com/apache/hadoop/pull/2832#discussion_r615608993
##########
File path:
hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/SimpleTcpClient.java
##########
@@ -48,40 +47,42 @@ public SimpleTcpClient(String host, int port, XDR request,
Boolean oneShot) {
this.request = request;
this.oneShot = oneShot;
}
-
- protected ChannelPipelineFactory setPipelineFactory() {
- this.pipelineFactory = new ChannelPipelineFactory() {
+
+ protected ChannelInitializer<SocketChannel> setChannelHandler() {
+ return new ChannelInitializer<SocketChannel>() {
@Override
- public ChannelPipeline getPipeline() {
- return Channels.pipeline(
+ protected void initChannel(SocketChannel ch) throws Exception {
+ ChannelPipeline p = ch.pipeline();
+ p.addLast(
RpcUtil.constructRpcFrameDecoder(),
- new SimpleTcpClientHandler(request));
+ new SimpleTcpClientHandler(request)
+ );
}
};
- return this.pipelineFactory;
}
public void run() {
// Configure the client.
- ChannelFactory factory = new NioClientSocketChannelFactory(
- Executors.newCachedThreadPool(), Executors.newCachedThreadPool(), 1,
1);
- ClientBootstrap bootstrap = new ClientBootstrap(factory);
-
- // Set up the pipeline factory.
- bootstrap.setPipelineFactory(setPipelineFactory());
+ NioEventLoopGroup workerGroup = new NioEventLoopGroup();
Review comment:
it's actually used by UT only. I'll add @VisibleForTesting to make it
clear.
(The only exception is TestOutOfOrderWrite class. It is a test but written
in a standalone application style, not in JUnit style. So, still a test)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]