Search in sources :

Example 1 with SofaRejectedExecutionHandler

use of com.alipay.sofa.rpc.server.SofaRejectedExecutionHandler in project sofa-rpc by sofastack.

the class AbstractHttpServer method initThreadPool.

protected ThreadPoolExecutor initThreadPool(ServerConfig serverConfig) {
    ThreadPoolExecutor threadPool = BusinessPool.initPool(serverConfig);
    threadPool.setThreadFactory(new NamedThreadFactory("SEV-" + serverConfig.getProtocol().toUpperCase() + "-BIZ-" + serverConfig.getPort(), serverConfig.isDaemon()));
    threadPool.setRejectedExecutionHandler(new SofaRejectedExecutionHandler());
    if (serverConfig.isPreStartCore()) {
        // 初始化核心线程池
        threadPool.prestartAllCoreThreads();
    }
    return threadPool;
}
Also used : SofaRejectedExecutionHandler(com.alipay.sofa.rpc.server.SofaRejectedExecutionHandler) NamedThreadFactory(com.alipay.sofa.rpc.common.struct.NamedThreadFactory) ThreadPoolExecutor(java.util.concurrent.ThreadPoolExecutor)

Example 2 with SofaRejectedExecutionHandler

use of com.alipay.sofa.rpc.server.SofaRejectedExecutionHandler in project sofa-rpc by sofastack.

the class BoltServer method initThreadPool.

protected ThreadPoolExecutor initThreadPool(ServerConfig serverConfig) {
    ThreadPoolExecutor threadPool = BusinessPool.initPool(serverConfig);
    threadPool.setThreadFactory(new NamedThreadFactory("SEV-BOLT-BIZ-" + serverConfig.getPort(), serverConfig.isDaemon()));
    threadPool.setRejectedExecutionHandler(new SofaRejectedExecutionHandler());
    if (serverConfig.isPreStartCore()) {
        // 初始化核心线程池
        threadPool.prestartAllCoreThreads();
    }
    return threadPool;
}
Also used : SofaRejectedExecutionHandler(com.alipay.sofa.rpc.server.SofaRejectedExecutionHandler) NamedThreadFactory(com.alipay.sofa.rpc.common.struct.NamedThreadFactory) ThreadPoolExecutor(java.util.concurrent.ThreadPoolExecutor)

Example 3 with SofaRejectedExecutionHandler

use of com.alipay.sofa.rpc.server.SofaRejectedExecutionHandler in project sofa-rpc by sofastack.

the class TripleServer method initThreadPool.

protected ThreadPoolExecutor initThreadPool(ServerConfig serverConfig) {
    ThreadPoolExecutor threadPool = BusinessPool.initPool(serverConfig);
    threadPool.setThreadFactory(new NamedThreadFactory("SEV-TRIPLE-BIZ-" + serverConfig.getPort(), serverConfig.isDaemon()));
    threadPool.setRejectedExecutionHandler(new SofaRejectedExecutionHandler());
    if (serverConfig.isPreStartCore()) {
        // 初始化核心线程池
        threadPool.prestartAllCoreThreads();
    }
    return threadPool;
}
Also used : SofaRejectedExecutionHandler(com.alipay.sofa.rpc.server.SofaRejectedExecutionHandler) NamedThreadFactory(com.alipay.sofa.rpc.common.struct.NamedThreadFactory) ThreadPoolExecutor(java.util.concurrent.ThreadPoolExecutor)

Aggregations

NamedThreadFactory (com.alipay.sofa.rpc.common.struct.NamedThreadFactory)3 SofaRejectedExecutionHandler (com.alipay.sofa.rpc.server.SofaRejectedExecutionHandler)3 ThreadPoolExecutor (java.util.concurrent.ThreadPoolExecutor)3