Java Code Examples for org.elasticsearch.common.unit.TimeValue#readTimeValue()

The following examples show how to use org.elasticsearch.common.unit.TimeValue#readTimeValue() . 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: ThreadPool.java    From Elasticsearch with Apache License 2.0 6 votes vote down vote up
@Override
public void readFrom(StreamInput in) throws IOException {
    name = in.readString();
    type = ThreadPoolType.fromType(in.readString());
    min = in.readInt();
    max = in.readInt();
    if (in.readBoolean()) {
        keepAlive = TimeValue.readTimeValue(in);
    }
    if (in.readBoolean()) {
        queueSize = SizeValue.readSizeValue(in);
    }
    in.readBoolean(); // here to conform with removed waitTime
    in.readBoolean(); // here to conform with removed rejected setting
    in.readBoolean(); // here to conform with queue type
}
 
Example 2
Source File: NodesHotThreadsRequest.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);
    threads = in.readInt();
    ignoreIdleThreads = in.readBoolean();
    type = in.readString();
    interval = TimeValue.readTimeValue(in);
    snapshots = in.readInt();
}
 
Example 3
Source File: ReplicationRequest.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);
    if (in.readBoolean()) {
        shardId = ShardId.readShardId(in);
    } else {
        shardId = null;
    }
    consistencyLevel = WriteConsistencyLevel.fromId(in.readByte());
    timeout = TimeValue.readTimeValue(in);
    index = in.readString();
    canHaveDuplicates = in.readBoolean();
    // no need to serialize threaded* parameters, since they only matter locally
}
 
Example 4
Source File: BaseTasksRequest.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);
    taskId = new TaskId(in);
    parentTaskId = new TaskId(in);
    nodesIds = in.readStringArray();
    actions = in.readStringArray();
    if (in.readBoolean()) {
        timeout = TimeValue.readTimeValue(in);
    }
}
 
Example 5
Source File: InstanceShardOperationRequest.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);
    index = in.readString();
    shardId = in.readInt();
    timeout = TimeValue.readTimeValue(in);
    concreteIndex = in.readOptionalString();
}
 
Example 6
Source File: BaseNodesRequest.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);
    nodesIds = in.readStringArray();
    if (in.readBoolean()) {
        timeout = TimeValue.readTimeValue(in);
    }
}
 
Example 7
Source File: IndexRequest.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);
    if (in.getVersion().before(Version.V_2_3_0)) {
        type = in.readString();
    } else {
        type = in.readOptionalString();
    }
    id = in.readOptionalString();
    routing = in.readOptionalString();
    parent = in.readOptionalString();
    timestamp = in.readOptionalString();
    if (in.getVersion().before(Version.V_2_2_0)) {
        long ttl = in.readLong();
        if (ttl == -1) {
            this.ttl = null;
        } else {
            ttl(ttl);
        }
    } else {
        ttl = in.readBoolean() ? TimeValue.readTimeValue(in) : null;
    }
    source = in.readBytesReference();

    opType = OpType.fromId(in.readByte());
    refresh = in.readBoolean();
    version = in.readLong();
    versionType = VersionType.fromValue(in.readByte());
    autoGeneratedId = in.readBoolean();
}
 
Example 8
Source File: IngestReplicaShardRequest.java    From elasticsearch-helper with Apache License 2.0 5 votes vote down vote up
@Override
public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);
    index = in.readString();
    timeout = TimeValue.readTimeValue(in);
    ingestId = in.readLong();
    shardId = ShardId.readShardId(in);
    int size = in.readVInt();
    actionRequests = new LinkedList<>();
    for (int i = 0; i < size; i++) {
        boolean exists = in.readBoolean();
        if (exists) {
            boolean b = in.readBoolean();
            if (b) {
                IndexRequest indexRequest = new IndexRequest();
                indexRequest.readFrom(in);
                actionRequests.add(indexRequest);
            } else {
                DeleteRequest deleteRequest = new DeleteRequest();
                deleteRequest.readFrom(in);
                actionRequests.add(deleteRequest);
            }
        } else {
            actionRequests.add(null);
        }
    }
}
 
Example 9
Source File: IngestLeaderShardRequest.java    From elasticsearch-helper with Apache License 2.0 5 votes vote down vote up
@Override
public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);
    index = in.readString();
    timeout = TimeValue.readTimeValue(in);
    requiredConsistency = Consistency.fromId(in.readByte());
    ingestId = in.readLong();
    shardId = ShardId.readShardId(in);
    int size = in.readVInt();
    actionRequests = new LinkedList<ActionRequest<?>>();
    for (int i = 0; i < size; i++) {
        boolean exists = in.readBoolean();
        if (exists) {
            boolean b = in.readBoolean();
            if (b) {
                IndexRequest indexRequest = new IndexRequest();
                indexRequest.readFrom(in);
                actionRequests.add(indexRequest);
            } else {
                DeleteRequest deleteRequest = new DeleteRequest();
                deleteRequest.readFrom(in);
                actionRequests.add(deleteRequest);
            }
        } else {
            actionRequests.add(null);
        }
    }
}
 
Example 10
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);
}
 
Example 11
Source File: MasterNodeRequest.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);
    masterNodeTimeout = TimeValue.readTimeValue(in);
}