Search in sources :

Example 1 with CallerRunsPolicyWithReport

use of io.dingodb.store.row.util.concurrent.CallerRunsPolicyWithReport in project dingo by dingodb.

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 = "dingo-row-store-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();
}
Also used : ArrayBlockingQueue(java.util.concurrent.ArrayBlockingQueue) NamedThreadFactory(io.dingodb.raft.util.NamedThreadFactory) Endpoint(io.dingodb.raft.util.Endpoint) CallerRunsPolicyWithReport(io.dingodb.store.row.util.concurrent.CallerRunsPolicyWithReport)

Example 2 with CallerRunsPolicyWithReport

use of io.dingodb.store.row.util.concurrent.CallerRunsPolicyWithReport in project dingo by dingodb.

the class DefaultDingoRowStoreRpcService 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 = "dingo-row-store-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();
}
Also used : ArrayBlockingQueue(java.util.concurrent.ArrayBlockingQueue) NamedThreadFactory(io.dingodb.raft.util.NamedThreadFactory) Endpoint(io.dingodb.raft.util.Endpoint) CallerRunsPolicyWithReport(io.dingodb.store.row.util.concurrent.CallerRunsPolicyWithReport)

Aggregations

Endpoint (io.dingodb.raft.util.Endpoint)2 NamedThreadFactory (io.dingodb.raft.util.NamedThreadFactory)2 CallerRunsPolicyWithReport (io.dingodb.store.row.util.concurrent.CallerRunsPolicyWithReport)2 ArrayBlockingQueue (java.util.concurrent.ArrayBlockingQueue)2