Search in sources :

Example 1 with ServerConfig

use of com.code.server.game.mahjong.config.ServerConfig in project summer by foxsugar.

the class MahjongApplication method main.

public static void main(String[] args) throws RegisterFailedException, IOException {
    SpringApplication.run(MahjongApplication.class, args);
    ServerConfig serverConfig = SpringUtil.getBean(ServerConfig.class);
    // 加载数据
    DataManager.initData(serverConfig.getDataFile());
    // 注册
    RedisManager.getGameRedisService().register(serverConfig.getServerType(), serverConfig.getServerId());
    // timer
    ThreadPool.execute(GameTimer.getInstance()::fire);
    // 心跳
    System.out.println("启动心跳");
    GameTimer.addTimerNode(new TimerNode(System.currentTimeMillis(), IConstant.SECOND_5, true, () -> RedisManager.getGameRedisService().heart(serverConfig.getServerId())));
// MsgConsumer.startAConsumer("gameLogicService", serverConfig.getServerId(), MsgDispatch::dispatch);
// MsgConsumer.startAConsumer("reconnService", serverConfig.getServerId(), MsgDispatch::dispatch);
// MsgConsumer.startAConsumer("mahjongRoomService", serverConfig.getServerId(), MsgDispatch::dispatch);
// MsgConsumer.startAConsumer("roomService", serverConfig.getServerId(), RoomMsgDispatch::dispatch);
}
Also used : ServerConfig(com.code.server.game.mahjong.config.ServerConfig) TimerNode(com.code.server.util.timer.TimerNode)

Aggregations

ServerConfig (com.code.server.game.mahjong.config.ServerConfig)1 TimerNode (com.code.server.util.timer.TimerNode)1