Search in sources :

Example 1 with Level

use of org.apache.dubbo.common.status.Status.Level in project dubbo by alibaba.

the class StatusUtils method getSummaryStatus.

public static Status getSummaryStatus(Map<String, Status> statuses) {
    Level level = Level.OK;
    StringBuilder msg = new StringBuilder();
    for (Map.Entry<String, Status> entry : statuses.entrySet()) {
        String key = entry.getKey();
        Status status = entry.getValue();
        Level l = status.getLevel();
        if (Level.ERROR.equals(l)) {
            level = Level.ERROR;
            if (msg.length() > 0) {
                msg.append(",");
            }
            msg.append(key);
        } else if (Level.WARN.equals(l)) {
            if (!Level.ERROR.equals(level)) {
                level = Level.WARN;
            }
            if (msg.length() > 0) {
                msg.append(",");
            }
            msg.append(key);
        }
    }
    return new Status(level, msg.toString());
}
Also used : Status(org.apache.dubbo.common.status.Status) Level(org.apache.dubbo.common.status.Status.Level) Map(java.util.Map)

Aggregations

Map (java.util.Map)1 Status (org.apache.dubbo.common.status.Status)1 Level (org.apache.dubbo.common.status.Status.Level)1