Added readTimeout, writeTimeout, readAcknowledged and writeAcknowledged methods variation without version as parameter, to be used by api that always read and write those parameters. Helps avoiding to call the variation that accepts a Version with actual version null.
This commit is contained in:
parent
ec3d858cc2
commit
adb83182a5
|
@ -81,13 +81,13 @@ public class DeleteRepositoryRequest extends AcknowledgedRequest<DeleteRepositor
|
|||
public void readFrom(StreamInput in) throws IOException {
|
||||
super.readFrom(in);
|
||||
name = in.readString();
|
||||
readTimeout(in, null);
|
||||
readTimeout(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeTo(StreamOutput out) throws IOException {
|
||||
super.writeTo(out);
|
||||
out.writeString(name);
|
||||
writeTimeout(out, null);
|
||||
writeTimeout(out);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,13 +40,13 @@ public class DeleteRepositoryResponse extends AcknowledgedResponse {
|
|||
@Override
|
||||
public void readFrom(StreamInput in) throws IOException {
|
||||
super.readFrom(in);
|
||||
readAcknowledged(in, null);
|
||||
readAcknowledged(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeTo(StreamOutput out) throws IOException {
|
||||
super.writeTo(out);
|
||||
writeAcknowledged(out, null);
|
||||
writeAcknowledged(out);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -23,7 +23,6 @@ import org.elasticsearch.ElasticSearchGenerationException;
|
|||
import org.elasticsearch.ElasticSearchIllegalArgumentException;
|
||||
import org.elasticsearch.action.ActionRequestValidationException;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedRequest;
|
||||
import org.elasticsearch.action.support.master.MasterNodeOperationRequest;
|
||||
import org.elasticsearch.common.bytes.BytesReference;
|
||||
import org.elasticsearch.common.io.stream.StreamInput;
|
||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||
|
@ -268,7 +267,7 @@ public class PutRepositoryRequest extends AcknowledgedRequest<PutRepositoryReque
|
|||
name = in.readString();
|
||||
type = in.readString();
|
||||
settings = readSettingsFromStream(in);
|
||||
readTimeout(in, null);
|
||||
readTimeout(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -277,6 +276,6 @@ public class PutRepositoryRequest extends AcknowledgedRequest<PutRepositoryReque
|
|||
out.writeString(name);
|
||||
out.writeString(type);
|
||||
writeSettingsToStream(settings, out);
|
||||
writeTimeout(out, null);
|
||||
writeTimeout(out);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
package org.elasticsearch.action.admin.cluster.repositories.put;
|
||||
|
||||
import org.elasticsearch.action.ActionResponse;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
import org.elasticsearch.common.io.stream.StreamInput;
|
||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||
|
@ -41,13 +40,13 @@ public class PutRepositoryResponse extends AcknowledgedResponse {
|
|||
@Override
|
||||
public void readFrom(StreamInput in) throws IOException {
|
||||
super.readFrom(in);
|
||||
readAcknowledged(in, null);
|
||||
readAcknowledged(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeTo(StreamOutput out) throws IOException {
|
||||
super.writeTo(out);
|
||||
writeAcknowledged(out, null);
|
||||
writeAcknowledged(out);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -40,13 +40,13 @@ public class DeleteSnapshotResponse extends AcknowledgedResponse {
|
|||
@Override
|
||||
public void readFrom(StreamInput in) throws IOException {
|
||||
super.readFrom(in);
|
||||
readAcknowledged(in, null);
|
||||
readAcknowledged(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeTo(StreamOutput out) throws IOException {
|
||||
super.writeTo(out);
|
||||
writeAcknowledged(out, null);
|
||||
writeAcknowledged(out);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -167,7 +167,7 @@ public class IndicesAliasesRequest extends AcknowledgedRequest<IndicesAliasesReq
|
|||
for (int i = 0; i < size; i++) {
|
||||
aliasActions.add(readAliasAction(in));
|
||||
}
|
||||
readTimeout(in, null);
|
||||
readTimeout(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -177,6 +177,6 @@ public class IndicesAliasesRequest extends AcknowledgedRequest<IndicesAliasesReq
|
|||
for (AliasAction aliasAction : aliasActions) {
|
||||
aliasAction.writeTo(out);
|
||||
}
|
||||
writeTimeout(out, null);
|
||||
writeTimeout(out);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,12 +41,12 @@ public class IndicesAliasesResponse extends AcknowledgedResponse {
|
|||
@Override
|
||||
public void readFrom(StreamInput in) throws IOException {
|
||||
super.readFrom(in);
|
||||
readAcknowledged(in, null);
|
||||
readAcknowledged(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeTo(StreamOutput out) throws IOException {
|
||||
super.writeTo(out);
|
||||
writeAcknowledged(out, null);
|
||||
writeAcknowledged(out);
|
||||
}
|
||||
}
|
|
@ -96,7 +96,7 @@ public class CloseIndexRequest extends AcknowledgedRequest<CloseIndexRequest> {
|
|||
public void readFrom(StreamInput in) throws IOException {
|
||||
super.readFrom(in);
|
||||
indices = in.readStringArray();
|
||||
readTimeout(in, null);
|
||||
readTimeout(in);
|
||||
ignoreIndices = IgnoreIndices.fromId(in.readByte());
|
||||
}
|
||||
|
||||
|
@ -104,7 +104,7 @@ public class CloseIndexRequest extends AcknowledgedRequest<CloseIndexRequest> {
|
|||
public void writeTo(StreamOutput out) throws IOException {
|
||||
super.writeTo(out);
|
||||
out.writeStringArray(indices);
|
||||
writeTimeout(out, null);
|
||||
writeTimeout(out);
|
||||
out.writeByte(ignoreIndices.id());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,12 +40,12 @@ public class CloseIndexResponse extends AcknowledgedResponse {
|
|||
@Override
|
||||
public void readFrom(StreamInput in) throws IOException {
|
||||
super.readFrom(in);
|
||||
readAcknowledged(in, null);
|
||||
readAcknowledged(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeTo(StreamOutput out) throws IOException {
|
||||
super.writeTo(out);
|
||||
writeAcknowledged(out, null);
|
||||
writeAcknowledged(out);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -96,7 +96,7 @@ public class OpenIndexRequest extends AcknowledgedRequest<OpenIndexRequest> {
|
|||
public void readFrom(StreamInput in) throws IOException {
|
||||
super.readFrom(in);
|
||||
indices = in.readStringArray();
|
||||
readTimeout(in, null);
|
||||
readTimeout(in);
|
||||
ignoreIndices = IgnoreIndices.fromId(in.readByte());
|
||||
}
|
||||
|
||||
|
@ -104,7 +104,7 @@ public class OpenIndexRequest extends AcknowledgedRequest<OpenIndexRequest> {
|
|||
public void writeTo(StreamOutput out) throws IOException {
|
||||
super.writeTo(out);
|
||||
out.writeStringArray(indices);
|
||||
writeTimeout(out, null);
|
||||
writeTimeout(out);
|
||||
out.writeByte(ignoreIndices.id());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,12 +40,12 @@ public class OpenIndexResponse extends AcknowledgedResponse {
|
|||
@Override
|
||||
public void readFrom(StreamInput in) throws IOException {
|
||||
super.readFrom(in);
|
||||
readAcknowledged(in, null);
|
||||
readAcknowledged(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeTo(StreamOutput out) throws IOException {
|
||||
super.writeTo(out);
|
||||
writeAcknowledged(out, null);
|
||||
writeAcknowledged(out);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,12 +41,12 @@ public class DeleteWarmerResponse extends AcknowledgedResponse {
|
|||
@Override
|
||||
public void readFrom(StreamInput in) throws IOException {
|
||||
super.readFrom(in);
|
||||
readAcknowledged(in, null);
|
||||
readAcknowledged(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeTo(StreamOutput out) throws IOException {
|
||||
super.writeTo(out);
|
||||
writeAcknowledged(out, null);
|
||||
writeAcknowledged(out);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,12 +41,12 @@ public class PutWarmerResponse extends AcknowledgedResponse {
|
|||
@Override
|
||||
public void readFrom(StreamInput in) throws IOException {
|
||||
super.readFrom(in);
|
||||
readAcknowledged(in, null);
|
||||
readAcknowledged(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeTo(StreamOutput out) throws IOException {
|
||||
super.writeTo(out);
|
||||
writeAcknowledged(out, null);
|
||||
writeAcknowledged(out);
|
||||
}
|
||||
}
|
|
@ -69,6 +69,13 @@ public abstract class AcknowledgedRequest<T extends MasterNodeOperationRequest>
|
|||
return timeout;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads the timeout value
|
||||
*/
|
||||
protected void readTimeout(StreamInput in) throws IOException {
|
||||
readTimeout(in, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads the timeout value if on or after the specified min version or if the version is <code>null</code>.
|
||||
*/
|
||||
|
@ -78,6 +85,13 @@ public abstract class AcknowledgedRequest<T extends MasterNodeOperationRequest>
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* writes the timeout value
|
||||
*/
|
||||
protected void writeTimeout(StreamOutput out) throws IOException {
|
||||
writeTimeout(out, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* writes the timeout value if on or after the specified min version or if the version is <code>null</code>.
|
||||
*/
|
||||
|
|
|
@ -49,6 +49,13 @@ public abstract class AcknowledgedResponse extends ActionResponse {
|
|||
return acknowledged;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads the timeout value
|
||||
*/
|
||||
protected void readAcknowledged(StreamInput in) throws IOException {
|
||||
readAcknowledged(in, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads the timeout value if on or after the specified min version or if the version is <code>null</code>.
|
||||
*/
|
||||
|
@ -58,6 +65,13 @@ public abstract class AcknowledgedResponse extends ActionResponse {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes the timeout value
|
||||
*/
|
||||
protected void writeAcknowledged(StreamOutput out) throws IOException {
|
||||
writeAcknowledged(out, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes the timeout value if on or after the specified min version or if the version is <code>null</code>.
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue