miduo_server/worldserver/src/main/java/com/WorldServerApplication.java

82 lines
2.3 KiB
Java
Raw Normal View History

2020-11-27 15:26:55 +08:00
package com;
2020-11-19 17:24:22 +08:00
import com.world.config.ConfigurableApplicationContextManager;
2020-12-07 14:44:12 +08:00
import com.world.config.WorldCoreSettings;
2020-12-03 21:02:17 +08:00
import com.world.db.mongo.MongoUtil;
2020-12-07 14:44:12 +08:00
import com.world.logic.arean.ArenaLogic;
2020-11-19 17:24:22 +08:00
import com.world.redis.RedisUtil;
import com.world.thread.ThreadManager;
2020-12-07 14:44:12 +08:00
import com.world.thrift.idl.pool.RPCServerTask;
2020-11-19 20:33:41 +08:00
import com.world.thrift.idl.pool.WorldRpcService;
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:
2020-11-27 15:26:55 +08:00
*
*
2020-11-19 17:24:22 +08:00
* Author: zsx
* CreateDate: 2020/11/19 11:48
*/
2020-11-19 20:33:41 +08:00
@Configuration
@EnableAutoConfiguration
@ComponentScan
@EnableScheduling
2020-11-19 17:24:22 +08:00
public class WorldServerApplication {
private static final Logger LOGGER = LoggerFactory.getLogger(WorldServerApplication.class);
2020-12-07 14:44:12 +08:00
public static WorldCoreSettings bean;
2020-12-03 21:02:17 +08:00
public static void main(String[] args) throws Exception {
2020-11-19 17:24:22 +08:00
ConfigurableApplicationContextManager.init(args);
2020-12-03 21:02:17 +08:00
try {
MongoUtil.getInstence().init();
2020-12-07 14:44:12 +08:00
} catch (Exception e) {
LOGGER.info("MongoUtil err ->{}", e);
}
try {
RedisUtil.getInstence().init();
2020-12-03 21:02:17 +08:00
} catch (Exception e) {
LOGGER.info("MongoUtil err ->{}", e);
}
2020-11-19 17:24:22 +08:00
//线程池管理器
ThreadManager threadManager = ThreadManager.getInstance();
threadManager.init();
2020-11-20 10:23:16 +08:00
try {
STableManager.initialize("config");
2020-12-03 21:02:17 +08:00
} catch (Exception e) {
2020-11-20 10:23:16 +08:00
LOGGER.info("STableManager err ->{}", e);
}
2020-12-03 21:02:17 +08:00
WorldRpcService.initHandler("com.world.handler", WorldServerApplication.class.getClassLoader());
2020-11-27 15:26:55 +08:00
2020-12-07 14:44:12 +08:00
new RPCServerTask().start();
2020-11-27 15:26:55 +08:00
//切换netty通信
2020-12-07 14:44:12 +08:00
// NetManager.getInstance().init();
try {
ArenaLogic.initRank();
}catch (Exception e){
LOGGER.info("ArenaLogic err ->{}", e);
}
2020-11-27 15:26:55 +08:00
2020-12-07 14:44:12 +08:00
bean = ConfigurableApplicationContextManager.getBean(WorldCoreSettings.class);
2020-11-19 17:24:22 +08:00
LOGGER.info("ServerProperties ->{}", bean.toString());
}
}