use of com.bonree.brfs.server.StorageName in project BRFS by zhangnianli.
the class TaskGenetor method genChangeSummary.
private void genChangeSummary(String zkUrl, ChangeType type) {
CuratorClient client = CuratorClient.getClientInstance(zkUrl);
try {
String changeServerId = "aaaaa";
List<StorageName> snList = getStorageCache();
for (StorageName snModel : snList) {
if (snModel.getReplications() > 1 && snModel.isRecover()) {
List<String> currentServers = getCurrentServers();
ChangeSummary tsm = new ChangeSummary(snModel.getIndex(), Calendar.getInstance().getTimeInMillis() / 1000, type, changeServerId, currentServers);
String snPath = basePath + SEPARATOR + snModel.getIndex();
String jsonStr = JSON.toJSONString(tsm);
if (!client.checkExists(snPath)) {
client.createPersistent(snPath, false);
}
String snTaskNode = snPath + SEPARATOR + tsm.getCreateTime();
client.createPersistent(snTaskNode, false, jsonStr.getBytes());
}
}
} finally {
client.close();
}
}
Aggregations