Search in sources :

Example 1 with ThreadPoolMetricSet

use of io.dingodb.raft.util.ThreadPoolMetricSet in project dingo by dingodb.

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;
}
Also used : ThreadPoolMetricSet(io.dingodb.raft.util.ThreadPoolMetricSet) ArrayBlockingQueue(java.util.concurrent.ArrayBlockingQueue) RaftRpcFactory(io.dingodb.raft.rpc.RaftRpcFactory) NamedThreadFactory(io.dingodb.raft.util.NamedThreadFactory)

Aggregations

RaftRpcFactory (io.dingodb.raft.rpc.RaftRpcFactory)1 NamedThreadFactory (io.dingodb.raft.util.NamedThreadFactory)1 ThreadPoolMetricSet (io.dingodb.raft.util.ThreadPoolMetricSet)1 ArrayBlockingQueue (java.util.concurrent.ArrayBlockingQueue)1