2020-11-19 17:24:22 +08:00
|
|
|
|
package com.global;
|
|
|
|
|
|
|
|
|
|
import com.global.config.ConfigurableApplicationContextManager;
|
|
|
|
|
import com.global.config.CoreSettings;
|
|
|
|
|
import com.global.redis.RedisUtil;
|
|
|
|
|
import com.global.thread.ThreadManager;
|
|
|
|
|
import com.global.thrift.pool.GlobalRpcService;
|
|
|
|
|
import com.global.thrift.pool.RPCServerTask;
|
2020-11-20 10:23:16 +08:00
|
|
|
|
import manager.STableManager;
|
2020-11-19 17:24:22 +08:00
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
|
import org.slf4j.LoggerFactory;
|
2020-11-19 20:33:41 +08:00
|
|
|
|
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
|
|
|
|
import org.springframework.context.annotation.ComponentScan;
|
|
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
|
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
2020-11-19 17:24:22 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Description:
|
|
|
|
|
* 1 提供服务管理 将gm部分功能迁移过来(开服人数控制等等)
|
|
|
|
|
* 2 全局命名(老代码还没加锁)
|
|
|
|
|
* 3 跨服玩法服务器分组 (初版直接作为跨服服务器 二次迭代 作为世界服网关 使用zookeeper注册发现服务 在此处处理转发逻辑 类似消息中间件)
|
|
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
* 获取分组信息
|
|
|
|
|
* Author: zsx
|
|
|
|
|
* CreateDate: 2020/11/17 17:36
|
|
|
|
|
*/
|
2020-11-19 20:33:41 +08:00
|
|
|
|
@Configuration
|
|
|
|
|
@EnableAutoConfiguration
|
|
|
|
|
@ComponentScan
|
|
|
|
|
@EnableScheduling
|
2020-11-19 17:24:22 +08:00
|
|
|
|
public class GlobalServerApplication {
|
|
|
|
|
private static final Logger LOGGER = LoggerFactory.getLogger(GlobalServerApplication.class);
|
|
|
|
|
public static CoreSettings bean;
|
|
|
|
|
public static void main(String[] args) {
|
|
|
|
|
|
|
|
|
|
ConfigurableApplicationContextManager.init(args);
|
|
|
|
|
|
|
|
|
|
//线程池管理器
|
|
|
|
|
ThreadManager threadManager = ThreadManager.getInstance();
|
|
|
|
|
threadManager.init();
|
|
|
|
|
|
2020-11-20 10:23:16 +08:00
|
|
|
|
try {
|
|
|
|
|
STableManager.initialize("config");
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
LOGGER.info("STableManager err ->{}", e);
|
|
|
|
|
}
|
|
|
|
|
|
2020-11-19 20:33:41 +08:00
|
|
|
|
GlobalRpcService.initHandler("com.global.handler",GlobalServerApplication.class.getClassLoader());
|
2020-11-19 17:24:22 +08:00
|
|
|
|
|
|
|
|
|
new RPCServerTask().start();
|
|
|
|
|
RedisUtil.getInstence().init();
|
|
|
|
|
bean = ConfigurableApplicationContextManager.getBean(CoreSettings.class);
|
|
|
|
|
LOGGER.info("ServerProperties ->{}", bean.toString());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|