Search in sources :

Example 1 with Role

use of com.navercorp.pinpoint.rpc.cluster.Role in project pinpoint by naver.

the class PinpointClientHandshaker method getClusterOption.

private ClusterOption getClusterOption(Map handshakeResponse) {
    if (handshakeResponse == Collections.EMPTY_MAP) {
        return ClusterOption.DISABLE_CLUSTER_OPTION;
    }
    Map cluster = (Map) handshakeResponse.get(ControlHandshakeResponsePacket.CLUSTER);
    if (cluster == null) {
        return ClusterOption.DISABLE_CLUSTER_OPTION;
    }
    String id = MapUtils.getString(cluster, "id", "");
    List<Role> roles = getRoles((List) cluster.get("roles"));
    if (StringUtils.isEmpty(id)) {
        return ClusterOption.DISABLE_CLUSTER_OPTION;
    } else {
        return new ClusterOption(true, id, roles);
    }
}
Also used : Role(com.navercorp.pinpoint.rpc.cluster.Role) ClusterOption(com.navercorp.pinpoint.rpc.cluster.ClusterOption) Map(java.util.Map)

Aggregations

ClusterOption (com.navercorp.pinpoint.rpc.cluster.ClusterOption)1 Role (com.navercorp.pinpoint.rpc.cluster.Role)1 Map (java.util.Map)1