# 客户端连接管理
package com.bfxy.rapid.rpc.client;
import java.net.SocketAddress;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import com.bfxy.rapid.rpc.codec.RpcRequest;
import com.bfxy.rapid.rpc.codec.RpcResponse;
import io.netty.buffer.Unpooled;
import io.netty.channel.Channel;
import io.netty.channel.ChannelFutureListener;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
/**
* $RpcClientHandler 实际的业务处理器(Handler)
* @author 17475
*
*/
public class RpcClientHandler extends SimpleChannelInboundHandler<RpcResponse> {
private Channel channel;
private SocketAddress remotePeer;
private Map<String /*requestId*/, RpcFuture> pendingRpcTable = new ConcurrentHashMap<String, RpcFuture>();
public Channel getChannel() {
return channel;
}
/**
* 通道激活的时候触发此方法
*/
public void channelRegistered(ChannelHandlerContext ctx) t
|