Search in sources :

Example 1 with ClusterManager

use of com.ctrip.platform.dal.dao.cluster.ClusterManager in project dal by ctripcorp.

the class DalConfigureFactory method readClusters.

private Map<String, DatabaseSet> readClusters(Node databaseSetsNode, DalConnectionLocator locator, DalConfigCustomizedOption defaultOption) throws Exception {
    Map<String, DatabaseSet> databaseSets = new HashMap<>();
    ClusterManager clusterManager = new ClusterManagerImpl(locator.getIntegratedConfigProvider());
    List<Node> clusterList = getChildNodes(databaseSetsNode, CLUSTER);
    for (Node node : clusterList) {
        DalConfigCustomizedOption option = defaultOption.clone();
        String name = getDatabaseSetName(node);
        overrideDefaultConfig(node, option);
        Cluster cluster = readCluster(node, clusterManager, option);
        databaseSets.put(name, new ClusterDatabaseSet(name, cluster, locator, getSettings(node)));
    }
    return databaseSets;
}
Also used : DalConfigCustomizedOption(com.ctrip.framework.dal.cluster.client.config.DalConfigCustomizedOption) HashMap(java.util.HashMap) ClusterManagerImpl(com.ctrip.platform.dal.dao.cluster.ClusterManagerImpl) Cluster(com.ctrip.framework.dal.cluster.client.Cluster) ClusterManager(com.ctrip.platform.dal.dao.cluster.ClusterManager)

Aggregations

Cluster (com.ctrip.framework.dal.cluster.client.Cluster)1 DalConfigCustomizedOption (com.ctrip.framework.dal.cluster.client.config.DalConfigCustomizedOption)1 ClusterManager (com.ctrip.platform.dal.dao.cluster.ClusterManager)1 ClusterManagerImpl (com.ctrip.platform.dal.dao.cluster.ClusterManagerImpl)1 HashMap (java.util.HashMap)1