/** * Intentionally make this method package-private, avoiding user directly * new an instance through this constructor. * * @param rpcConnectionKey RpcConnectionKey * @param eventLoopGroup Thread pool of netty's * @param rpcParams Rpc connection parameters (see RpcConstants) * * @throws ClassNotFoundException * @throws NoSuchMethodException */ AsyncRpcClient(EventLoopGroup eventLoopGroup, RpcConnectionKey rpcConnectionKey, Properties rpcParams) throws ClassNotFoundException, NoSuchMethodException { super(rpcConnectionKey, rpcParams); this.stubMethod = getServiceClass().getMethod("newStub", RpcChannel.class); this.rpcChannel = new ProxyRpcChannel(); this.handler = new ClientChannelInboundHandler(); final long socketTimeoutMills = Long.parseLong( rpcParams.getProperty(CLIENT_SOCKET_TIMEOUT, String.valueOf(CLIENT_SOCKET_TIMEOUT_DEFAULT))); // Enable proactive hang detection final boolean hangDetectionEnabled = Boolean.parseBoolean( rpcParams.getProperty(CLIENT_HANG_DETECTION, String.valueOf(CLIENT_HANG_DETECTION_DEFAULT))); init(new ProtoClientChannelInitializer(handler, RpcResponse.getDefaultInstance(), socketTimeoutMills, hangDetectionEnabled), eventLoopGroup); }
/** * Intentionally make this method package-private, avoiding user directly * new an instance through this constructor. * * @param rpcConnectionKey RpcConnectionKey * @param eventLoopGroup Thread pool of netty's * @param rpcParams Rpc connection parameters (see RpcConstants) * * @throws ClassNotFoundException * @throws NoSuchMethodException */ AsyncRpcClient(EventLoopGroup eventLoopGroup, RpcConnectionKey rpcConnectionKey, Properties rpcParams) throws ClassNotFoundException, NoSuchMethodException { super(rpcConnectionKey, rpcParams); this.stubMethod = getServiceClass().getMethod("newStub", RpcChannel.class); this.rpcChannel = new ProxyRpcChannel(); this.handler = new ClientChannelInboundHandler(); final long socketTimeoutMills = Long.parseLong( rpcParams.getProperty(CLIENT_SOCKET_TIMEOUT, String.valueOf(CLIENT_SOCKET_TIMEOUT_DEFAULT))); // Enable proactive hang detection final boolean hangDetectionEnabled = Boolean.parseBoolean( rpcParams.getProperty(CLIENT_HANG_DETECTION, String.valueOf(CLIENT_HANG_DETECTION_DEFAULT))); init(new ProtoClientChannelInitializer(handler, RpcResponse.getDefaultInstance(), socketTimeoutMills, hangDetectionEnabled), eventLoopGroup); }
AsyncRpcClient(RpcConnectionKey rpcConnectionKey, int retries, int idleTimeSeconds) throws ClassNotFoundException, NoSuchMethodException { super(rpcConnectionKey, retries); stubMethod = getServiceClass().getMethod("newStub", RpcChannel.class); rpcChannel = new ProxyRpcChannel(); inboundHandler = new ClientChannelInboundHandler(); init(new ProtoChannelInitializer(inboundHandler, RpcResponse.getDefaultInstance(), idleTimeSeconds)); }