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

59 lines
1.9 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;
import com.world.config.CoreSettings;
2020-11-27 15:26:55 +08:00
import com.world.network.NetManager;
2020-11-19 17:24:22 +08:00
import com.world.redis.RedisUtil;
import com.world.thread.ThreadManager;
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);
public static CoreSettings bean;
2020-11-27 15:26:55 +08:00
public static void main(String[] args)throws Exception {
2020-11-19 17:24:22 +08:00
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
WorldRpcService.initHandler("com.world.handler",WorldServerApplication.class.getClassLoader());
2020-11-27 15:26:55 +08:00
// new RPCServerTask().start();
//切换netty通信
NetManager.getInstance().init();
2020-11-19 17:24:22 +08:00
RedisUtil.getInstence().init();
bean = ConfigurableApplicationContextManager.getBean(CoreSettings.class);
LOGGER.info("ServerProperties ->{}", bean.toString());
}
}