use of com.alipay.sofa.jraft.rhea.util.concurrent.CallerRunsPolicyWithReport in project sofa-jraft by sofastack.
the class PlacementDriverServer method createDefaultPdExecutor.
private ThreadPoolExecutor createDefaultPdExecutor() {
final int corePoolSize = Math.max(Utils.cpus() << 2, 32);
final String name = "rheakv-pd-executor";
return //
ThreadPoolUtil.newBuilder().poolName(//
name).enableMetric(//
true).coreThreads(//
corePoolSize).maximumThreads(//
corePoolSize << 2).keepAliveSeconds(//
120L).workQueue(//
new ArrayBlockingQueue<>(4096)).threadFactory(//
new NamedThreadFactory(name, true)).rejectedHandler(//
new CallerRunsPolicyWithReport(name, name)).build();
}
use of com.alipay.sofa.jraft.rhea.util.concurrent.CallerRunsPolicyWithReport in project sofa-jraft by sofastack.
the class DefaultPlacementDriverRpcService 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-pd-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();
}
use of com.alipay.sofa.jraft.rhea.util.concurrent.CallerRunsPolicyWithReport in project sofa-jraft by sofastack.
the class DefaultPlacementDriverService method createPipelineExecutor.
private ThreadPoolExecutor createPipelineExecutor(final PlacementDriverServerOptions opts) {
final int corePoolSize = opts.getPipelineCorePoolSize();
final int maximumPoolSize = opts.getPipelineMaximumPoolSize();
if (corePoolSize <= 0 || maximumPoolSize <= 0) {
return null;
}
final String name = "rheakv-pipeline-executor";
return //
ThreadPoolUtil.newBuilder().poolName(//
name).enableMetric(//
false).coreThreads(//
corePoolSize).maximumThreads(//
maximumPoolSize).keepAliveSeconds(//
120L).workQueue(//
new ArrayBlockingQueue<>(1024)).threadFactory(//
new NamedThreadFactory(name, true)).rejectedHandler(//
new CallerRunsPolicyWithReport(name)).build();
}
use of com.alipay.sofa.jraft.rhea.util.concurrent.CallerRunsPolicyWithReport 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