Search in sources :

Example 1 with TripleServer

use of com.alipay.sofa.rpc.server.triple.TripleServer in project sofa-boot by alipay.

the class ServerConfigContainer method startServers.

/**
 * 开启所有 ServerConfig 对应的 Server
 */
public void startServers() {
    if (boltServerConfig != null) {
        boltServerConfig.buildIfAbsent().start();
        BoltServer server = (BoltServer) boltServerConfig.getServer();
        ThreadPoolExecutor threadPoolExecutor = server.getBizThreadPool();
        if (threadPoolExecutor != null) {
            boltThreadPoolMonitor.setThreadPoolExecutor(threadPoolExecutor);
            boltThreadPoolMonitor.start();
        } else {
            if (LOGGER.isWarnEnabled()) {
                LOGGER.warn("the business threadpool can not be get");
            }
        }
    }
    if (restServerConfig != null) {
        restServerConfig.buildIfAbsent().start();
    }
    if (h2cServerConfig != null) {
        h2cServerConfig.buildIfAbsent().start();
    }
    if (httpServerConfig != null) {
        httpServerConfig.buildIfAbsent().start();
    // 加入线程监测?
    }
    if (tripleServerConfig != null) {
        tripleServerConfig.buildIfAbsent().start();
        TripleServer tripleServer = (TripleServer) tripleServerConfig.getServer();
        ThreadPoolExecutor threadPoolExecutor = tripleServer.getBizThreadPool();
        if (threadPoolExecutor != null) {
            tripleThreadPoolMonitor.setThreadPoolExecutor(threadPoolExecutor);
            tripleThreadPoolMonitor.start();
        } else {
            if (LOGGER.isWarnEnabled()) {
                LOGGER.warn("the business threadpool can not be get");
            }
        }
    }
    for (Map.Entry<String, ServerConfig> entry : customServerConfigs.entrySet()) {
        final ServerConfig serverConfig = entry.getValue();
        if (serverConfig != null) {
            serverConfig.buildIfAbsent().start();
        }
    }
    startCustomThreadPoolMonitor();
}
Also used : ServerConfig(com.alipay.sofa.rpc.config.ServerConfig) ThreadPoolExecutor(java.util.concurrent.ThreadPoolExecutor) BoltServer(com.alipay.sofa.rpc.server.bolt.BoltServer) TripleServer(com.alipay.sofa.rpc.server.triple.TripleServer) HashMap(java.util.HashMap) Map(java.util.Map) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap)

Example 2 with TripleServer

use of com.alipay.sofa.rpc.server.triple.TripleServer in project sofa-boot by sofastack.

the class ServerConfigContainer method startServers.

/**
 * 开启所有 ServerConfig 对应的 Server
 */
public void startServers() {
    if (boltServerConfig != null) {
        boltServerConfig.buildIfAbsent().start();
        BoltServer server = (BoltServer) boltServerConfig.getServer();
        ThreadPoolExecutor threadPoolExecutor = server.getBizThreadPool();
        if (threadPoolExecutor != null) {
            boltThreadPoolMonitor.setThreadPoolExecutor(threadPoolExecutor);
            boltThreadPoolMonitor.start();
        } else {
            if (LOGGER.isWarnEnabled()) {
                LOGGER.warn("the business threadpool can not be get");
            }
        }
    }
    if (restServerConfig != null) {
        restServerConfig.buildIfAbsent().start();
    }
    if (h2cServerConfig != null) {
        h2cServerConfig.buildIfAbsent().start();
    }
    if (httpServerConfig != null) {
        httpServerConfig.buildIfAbsent().start();
    // 加入线程监测?
    }
    if (tripleServerConfig != null) {
        tripleServerConfig.buildIfAbsent().start();
        TripleServer tripleServer = (TripleServer) tripleServerConfig.getServer();
        ThreadPoolExecutor threadPoolExecutor = tripleServer.getBizThreadPool();
        if (threadPoolExecutor != null) {
            tripleThreadPoolMonitor.setThreadPoolExecutor(threadPoolExecutor);
            tripleThreadPoolMonitor.start();
        } else {
            if (LOGGER.isWarnEnabled()) {
                LOGGER.warn("the business threadpool can not be get");
            }
        }
    }
    for (Map.Entry<String, ServerConfig> entry : customServerConfigs.entrySet()) {
        final ServerConfig serverConfig = entry.getValue();
        if (serverConfig != null) {
            serverConfig.buildIfAbsent().start();
        }
    }
    startCustomThreadPoolMonitor();
}
Also used : ServerConfig(com.alipay.sofa.rpc.config.ServerConfig) ThreadPoolExecutor(java.util.concurrent.ThreadPoolExecutor) BoltServer(com.alipay.sofa.rpc.server.bolt.BoltServer) TripleServer(com.alipay.sofa.rpc.server.triple.TripleServer) HashMap(java.util.HashMap) Map(java.util.Map) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap)

Aggregations

ServerConfig (com.alipay.sofa.rpc.config.ServerConfig)2 BoltServer (com.alipay.sofa.rpc.server.bolt.BoltServer)2 TripleServer (com.alipay.sofa.rpc.server.triple.TripleServer)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)2 ThreadPoolExecutor (java.util.concurrent.ThreadPoolExecutor)2