use of com.alipay.sofa.jraft.rhea.util.concurrent.NamedThreadFactory in project sofa-jraft by sofastack.
the class DefaultRheaKVRpcService method createRpcCallbackExecutor.
private ThreadPoolExecutor createRpcCallbackExecutor(final RpcOptions opts) {
final int callbackExecutorCorePoolSize = opts.getCallbackExecutorCorePoolSize();
final int callbackExecutorMaximumPoolSize = opts.getCallbackExecutorMaximumPoolSize();
if (callbackExecutorCorePoolSize <= 0 || callbackExecutorMaximumPoolSize <= 0) {
return null;
}
final String name = "rheakv-rpc-callback";
return //
ThreadPoolUtil.newBuilder().poolName(//
name).enableMetric(//
true).coreThreads(//
callbackExecutorCorePoolSize).maximumThreads(//
callbackExecutorMaximumPoolSize).keepAliveSeconds(//
120L).workQueue(//
new ArrayBlockingQueue<>(opts.getCallbackExecutorQueueCapacity())).threadFactory(//
new NamedThreadFactory(name, true)).rejectedHandler(//
new CallerRunsPolicyWithReport(name)).build();
}
Aggregations