use of io.mycat.config.model.ClusterConfig in project Mycat-Server by MyCATApache.
the class XMLServerLoader method load.
private void load() {
//读取server.xml配置
InputStream dtd = null;
InputStream xml = null;
try {
dtd = XMLServerLoader.class.getResourceAsStream("/server.dtd");
xml = XMLServerLoader.class.getResourceAsStream("/server.xml");
Element root = ConfigUtil.getDocument(dtd, xml).getDocumentElement();
//加载System标签
loadSystem(root);
//加载User标签
loadUsers(root);
//加载集群配置
this.cluster = new ClusterConfig(root, system.getServerPort());
//加载全局SQL防火墙
loadFirewall(root);
} catch (ConfigException e) {
throw e;
} catch (Exception e) {
throw new ConfigException(e);
} finally {
if (dtd != null) {
try {
dtd.close();
} catch (IOException e) {
}
}
if (xml != null) {
try {
xml.close();
} catch (IOException e) {
}
}
}
}
Aggregations