Search in sources :

Example 1 with RemedyIndexComparator

use of com.alibaba.otter.shared.arbitrate.impl.setl.helper.RemedyIndexComparator in project otter by alibaba.

the class ToolArbitrateEvent method listRemedyIndexs.

/**
     * 查询当前的remedy index记录
     */
public List<RemedyIndexEventData> listRemedyIndexs(Long pipelineId) {
    String path = StagePathUtils.getRemedyRoot(pipelineId);
    List<RemedyIndexEventData> datas = new ArrayList<RemedyIndexEventData>();
    try {
        List<String> nodes = zookeeper.getChildren(path);
        for (String node : nodes) {
            RemedyIndexEventData data = RemedyIndexEventData.parseNodeName(node);
            data.setPipelineId(pipelineId);
            datas.add(data);
        }
    } catch (ZkException e) {
        throw new ArbitrateException("listRemedyIndexs", pipelineId.toString(), e);
    }
    // 做一下排序
    Collections.sort(datas, new RemedyIndexComparator());
    return datas;
}
Also used : RemedyIndexEventData(com.alibaba.otter.shared.arbitrate.model.RemedyIndexEventData) ZkException(org.I0Itec.zkclient.exception.ZkException) RemedyIndexComparator(com.alibaba.otter.shared.arbitrate.impl.setl.helper.RemedyIndexComparator) ArrayList(java.util.ArrayList) ArbitrateException(com.alibaba.otter.shared.arbitrate.exception.ArbitrateException)

Aggregations

ArbitrateException (com.alibaba.otter.shared.arbitrate.exception.ArbitrateException)1 RemedyIndexComparator (com.alibaba.otter.shared.arbitrate.impl.setl.helper.RemedyIndexComparator)1 RemedyIndexEventData (com.alibaba.otter.shared.arbitrate.model.RemedyIndexEventData)1 ArrayList (java.util.ArrayList)1 ZkException (org.I0Itec.zkclient.exception.ZkException)1