private RpcServer initRpcServer() throws IOException { //hostname HostnameSupplier hostnameSupplier = new HostnameSupplier(hbaseConf); String hostName = hostnameSupplier.get(); //socketAddress InetSocketAddress socketAddress = null; for (int i = 1; i <= 10; i++) { try { socketAddress = new InetSocketAddress(hostName, randomPort()); break; } catch (Exception e) { logger.error("InetSocketAddress create failed in " + i + " times.", e); } } if (socketAddress == null || socketAddress.getAddress() == null) { throw new IllegalArgumentException("Failed to create " + socketAddress); } //rpcServer String name = "regionserver/" + socketAddress.toString(); this.serverName = ServerName.valueOf(hostName, socketAddress.getPort(), System.currentTimeMillis()); //handler-count设置为2,设置大了也没用,因为TaskReader<->TaskWriter是单线程模型 //并且源端的RegionServer推送Log的时候是单线程推送的,我们创建Task的时候,会比源端集群的RegionServer数目多, // 同一时刻,打到一个Task上的请求数不会太多 return new RpcServer(this, name, getServices(), socketAddress, hbaseConf, new FifoRpcScheduler(hbaseConf, hbaseConf.getInt(HConstants.REGION_SERVER_HANDLER_COUNT, 2))); }
rpcServer = new RpcServer(rs, name, getServices(),
this.rpcServer = new RpcServer(this, name, getServices(),
this.rpcServer = new RpcServer(this, name, getServices(),