Java Code Examples for org.elasticsearch.cluster.health.ClusterHealthStatus#fromValue()

The following examples show how to use org.elasticsearch.cluster.health.ClusterHealthStatus#fromValue() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ClusterHealthRequest.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
@Override
public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);
    int size = in.readVInt();
    if (size == 0) {
        indices = Strings.EMPTY_ARRAY;
    } else {
        indices = new String[size];
        for (int i = 0; i < indices.length; i++) {
            indices[i] = in.readString();
        }
    }
    timeout = readTimeValue(in);
    if (in.readBoolean()) {
        waitForStatus = ClusterHealthStatus.fromValue(in.readByte());
    }
    waitForRelocatingShards = in.readInt();
    waitForActiveShards = in.readInt();
    waitForNodes = in.readString();
    if (in.readBoolean()) {
        waitForEvents = Priority.readFrom(in);
    }
}
 
Example 2
Source File: ClusterHealthRequest.java    From crate with Apache License 2.0 6 votes vote down vote up
public ClusterHealthRequest(StreamInput in) throws IOException {
    super(in);
    int size = in.readVInt();
    if (size == 0) {
        indices = Strings.EMPTY_ARRAY;
    } else {
        indices = new String[size];
        for (int i = 0; i < indices.length; i++) {
            indices[i] = in.readString();
        }
    }
    timeout = in.readTimeValue();
    if (in.readBoolean()) {
        waitForStatus = ClusterHealthStatus.fromValue(in.readByte());
    }
    waitForNoRelocatingShards = in.readBoolean();
    waitForActiveShards = ActiveShardCount.readFrom(in);
    waitForNodes = in.readString();
    if (in.readBoolean()) {
        waitForEvents = Priority.readFrom(in);
    }
    waitForNoInitializingShards = in.readBoolean();
}
 
Example 3
Source File: ClusterStatsResponse.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);
    timestamp = in.readVLong();
    status = null;
    if (in.readBoolean()) {
        // it may be that the master switched on us while doing the operation. In this case the status may be null.
        status = ClusterHealthStatus.fromValue(in.readByte());
    }
    clusterUUID = in.readString();
    nodesStats = ClusterStatsNodes.readNodeStats(in);
    indicesStats = ClusterStatsIndices.readIndicesStats(in);
}
 
Example 4
Source File: ClusterStatsNodeResponse.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);
    clusterStatus = null;
    if (in.readBoolean()) {
        clusterStatus = ClusterHealthStatus.fromValue(in.readByte());
    }
    this.nodeInfo = NodeInfo.readNodeInfo(in);
    this.nodeStats = NodeStats.readNodeStats(in);
    int size = in.readVInt();
    shardsStats = new ShardStats[size];
    for (size--; size >= 0; size--) {
        shardsStats[size] = ShardStats.readShardStats(in);
    }
}
 
Example 5
Source File: ClusterHealthResponse.java    From crate with Apache License 2.0 5 votes vote down vote up
public ClusterHealthResponse(StreamInput in) throws IOException {
    clusterName = in.readString();
    clusterHealthStatus = ClusterHealthStatus.fromValue(in.readByte());
    clusterStateHealth = new ClusterStateHealth(in);
    numberOfPendingTasks = in.readInt();
    timedOut = in.readBoolean();
    numberOfInFlightFetch = in.readInt();
    delayedUnassignedShards = in.readInt();
    taskMaxWaitingTime = in.readTimeValue();
}
 
Example 6
Source File: ClusterHealthResponse.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);
    clusterName = in.readString();
    // read in a wire-compatible format for 2.x
    int activePrimaryShards = in.readVInt();
    int activeShards = in.readVInt();
    int relocatingShards = in.readVInt();
    int initializingShards = in.readVInt();
    int unassignedShards = in.readVInt();
    int numberOfNodes = in.readVInt();
    int numberOfDataNodes = in.readVInt();
    numberOfPendingTasks = in.readInt();
    ClusterHealthStatus status = ClusterHealthStatus.fromValue(in.readByte());
    int size = in.readVInt();
    Map<String, ClusterIndexHealth> indices = new HashMap<>();
    for (int i = 0; i < size; i++) {
        ClusterIndexHealth indexHealth = ClusterIndexHealth.readClusterIndexHealth(in);
        indices.put(indexHealth.getIndex(), indexHealth);
    }
    timedOut = in.readBoolean();
    size = in.readVInt();
    List<String> validationFailures;
    if (size == 0) {
        validationFailures = Collections.emptyList();
    } else {
        validationFailures = new ArrayList<>(size);
        for (int i = 0; i < size; i++) {
            validationFailures.add(in.readString());
        }
    }

    numberOfInFlightFetch = in.readInt();
    if (in.getVersion().onOrAfter(Version.V_1_7_0)) {
        delayedUnassignedShards= in.readInt();
    }

    double activeShardsPercent = in.readDouble();
    taskMaxWaitingTime = TimeValue.readTimeValue(in);
    clusterStateHealth = new ClusterStateHealth(numberOfNodes, numberOfDataNodes, activeShards, relocatingShards, activePrimaryShards,
            initializingShards, unassignedShards, activeShardsPercent, status, validationFailures, indices);
}