Search in sources :

Example 1 with ClusterConfig

use of com.alibaba.cobar.config.model.ClusterConfig in project cobar by alibaba.

the class XMLServerLoader method load.

private void load() {
    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();
        loadSystem(root);
        loadUsers(root);
        this.cluster = new ClusterConfig(root, system.getServerPort());
        loadQuarantine(root);
    } catch (ConfigException e) {
        throw e;
    } catch (Throwable e) {
        throw new ConfigException(e);
    } finally {
        if (dtd != null) {
            try {
                dtd.close();
            } catch (IOException e) {
            }
        }
        if (xml != null) {
            try {
                xml.close();
            } catch (IOException e) {
            }
        }
    }
}
Also used : InputStream(java.io.InputStream) Element(org.w3c.dom.Element) ConfigException(com.alibaba.cobar.config.util.ConfigException) IOException(java.io.IOException) ClusterConfig(com.alibaba.cobar.config.model.ClusterConfig)

Aggregations

ClusterConfig (com.alibaba.cobar.config.model.ClusterConfig)1 ConfigException (com.alibaba.cobar.config.util.ConfigException)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 Element (org.w3c.dom.Element)1