提交 50dbe7d0 编写于 作者: C CalvinKirs

async not needed callback

上级 c9daf6a4
......@@ -30,11 +30,6 @@ import io.netty.handler.codec.MessageToByteEncoder;
* NettyEncoder
*/
public class NettyEncoder extends MessageToByteEncoder<RpcProtocol<Object>> {
private Class<?> genericClass;
public NettyEncoder(Class<?> genericClass) {
this.genericClass = genericClass;
}
@Override
protected void encode(ChannelHandlerContext channelHandlerContext, RpcProtocol<Object> msg, ByteBuf byteBuf) throws Exception {
......
......@@ -19,6 +19,10 @@ package org.apache.dolphinscheduler.rpc.protocol;
public class RpcProtocolConstants {
public RpcProtocolConstants() {
throw new IllegalStateException("Utility class");
}
public static final int HEADER_LENGTH = 17;
public static final short MAGIC = (short) 0xbabe;
......
......@@ -181,7 +181,7 @@ public class NettyClient {
@Override
public void initChannel(SocketChannel ch) {
ch.pipeline()
.addLast(new NettyEncoder(RpcRequest.class))
.addLast(new NettyEncoder())
.addLast(new NettyDecoder(RpcResponse.class))
.addLast("client-idle-handler", new IdleStateHandler(Constants.NETTY_CLIENT_HEART_BEAT_TIME, 0, 0, TimeUnit.MILLISECONDS))
.addLast(new NettyClientHandler());
......@@ -191,7 +191,7 @@ public class NettyClient {
isStarted.compareAndSet(false, true);
}
public RpcResponse sendMsg(Host host, RpcProtocol<RpcRequest> protocol, Boolean async) throws InterruptedException {
public RpcResponse sendMsg(Host host, RpcProtocol<RpcRequest> protocol, Boolean async) {
Channel channel = getChannel(host);
assert channel != null;
......
......@@ -23,7 +23,6 @@ import org.apache.dolphinscheduler.remote.utils.NettyUtils;
import org.apache.dolphinscheduler.rpc.codec.NettyDecoder;
import org.apache.dolphinscheduler.rpc.codec.NettyEncoder;
import org.apache.dolphinscheduler.rpc.common.RpcRequest;
import org.apache.dolphinscheduler.rpc.common.RpcResponse;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;
......@@ -172,7 +171,7 @@ public class NettyServer {
private void initNettyChannel(SocketChannel ch) {
ch.pipeline()
.addLast(new NettyDecoder(RpcRequest.class))
.addLast(new NettyEncoder(RpcResponse.class))
.addLast(new NettyEncoder())
.addLast("server-idle-handle", new IdleStateHandler(0, 0, Constants.NETTY_SERVER_HEART_BEAT_TIME, TimeUnit.MILLISECONDS))
.addLast("handler", new NettyServerHandler());
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册