1. 增加模块加载工具,实现游戏业务模块热更新
项目网站:http://www.53hql.com/lightning4j
项目WiKi:http://www.53hql.com/lightning4j/wiki
monospace; vertical-align: baseline; margin: 0px; border: 0px; padding: 0px;">ServerInit.getInstance().initConfPath("conf");
<?xml version="1.0" encoding="UTF-8"?>
<handlers>
<!--模块名和模块jar文件名对应-->
<test>
<test><!--handler注册名-->
com.hql.test.handler.HandlerTest<!--类名-->
</test>
<onDisconnect>
com.hql.test.handler.DisconnectHandlerTest
</onDisconnect>
......
</test>
......
</handlers>
public class Server {
public void run() throws Exception {
ServerInit.getInstance().initConfPath("conf");
ServerInit.getInstance().initLog4j();
ServerInit.getInstance().initGameWorkers();
ServerInit.getInstance().initModules();
GameBoss.getInstance().boot(new GameUpProcessor() {
@Override
public void process(GameUpBuffer buffer) {
GameWorkerManager.getInstance().pushDataToWorker(buffer);
}
});
}
public static void main(String[] args) throws Exception {
new Server().run();
}
}
ModuleUtil.getInstance().updateModule("test2");//更新test2模块