org.apache.hadoop.ipc.Client.Connection#sendRpcRequest
:
这个方法是客户端侧向服务端发送RPC请求的地方。调用点是Client#call方法过来的。
此方法代码注释里描述了一个细节:这个向服务端发送RPC请求数据的过程并不是由Connection线程发送的,而是其他的线程(sendParamsExecutor这个线程池)。
sendRpcRequest方法的逻辑如下:
1、把参数Call序列化到一个buffer里。这个过程是caller线程做的;
2、提交发送序列化数据buffer到服务端的任务
3、调用get方法阻塞式等待发送RPC请求完成。
/** Initiates a rpc call by sending the rpc request to the remote server.* Note: this is not called from the Connection thread, but by other* threads.* @param call - the rpc request*/public void sendRpcRequest(final Call call)