Search in sources :

Example 1 with HaDatasourceInfo

use of com.alibaba.otter.common.push.supplier.HaDatasourceInfo in project otter by alibaba.

the class MediaDatasourceSupplier method parse.

private HaDatasourceInfo parse(String matrixStr) {
    HaDatasourceInfo haInfo = new HaDatasourceInfo();
    Map jsonMap = JsonUtils.unmarshalFromString(matrixStr, HashMap.class);
    String masterAddress = (String) jsonMap.get("master");
    if (masterAddress != null) {
        DatasourceInfo master = new DatasourceInfo();
        master.setAddress(parseAddress(masterAddress));
        haInfo.setMaster(master);
    }
    String slaveAddress = (String) jsonMap.get("master");
    if (slaveAddress != null) {
        DatasourceInfo slave = new DatasourceInfo();
        slave.setAddress(parseAddress(slaveAddress));
        haInfo.getSlavers().add(slave);
    }
    return haInfo;
}
Also used : HaDatasourceInfo(com.alibaba.otter.common.push.supplier.HaDatasourceInfo) DatasourceInfo(com.alibaba.otter.common.push.supplier.DatasourceInfo) HaDatasourceInfo(com.alibaba.otter.common.push.supplier.HaDatasourceInfo) HashMap(java.util.HashMap) Map(java.util.Map)

Aggregations

DatasourceInfo (com.alibaba.otter.common.push.supplier.DatasourceInfo)1 HaDatasourceInfo (com.alibaba.otter.common.push.supplier.HaDatasourceInfo)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1