use of com.alipay.sofa.jraft.rpc.RaftRpcFactory in project sofa-jraft by sofastack.
the class AbstractClientService method initRpcClient.
protected boolean initRpcClient(final int rpcProcessorThreadPoolSize) {
final RaftRpcFactory factory = RpcFactoryHelper.rpcFactory();
this.rpcClient = factory.createRpcClient(factory.defaultJRaftClientConfigHelper(this.rpcOptions));
configRpcClient(this.rpcClient);
this.rpcClient.init(null);
this.rpcExecutor = //
ThreadPoolUtil.newBuilder().poolName(//
"JRaft-RPC-Processor").enableMetric(//
true).coreThreads(//
rpcProcessorThreadPoolSize / 3).maximumThreads(//
rpcProcessorThreadPoolSize).keepAliveSeconds(//
60L).workQueue(//
new ArrayBlockingQueue<>(10000)).threadFactory(//
new NamedThreadFactory("JRaft-RPC-Processor-", true)).build();
if (this.rpcOptions.getMetricRegistry() != null) {
this.rpcOptions.getMetricRegistry().register("raft-rpc-client-thread-pool", new ThreadPoolMetricSet(this.rpcExecutor));
Utils.registerClosureExecutorMetrics(this.rpcOptions.getMetricRegistry());
}
return true;
}
Aggregations