Removed redundant version checks in transport serialization (#4731 leftover)

This commit is contained in:
Luca Cavanna 2014-01-24 16:12:25 +01:00
parent 107a242d38
commit 61158387fe
9 changed files with 12 additions and 38 deletions

View File

@ -19,7 +19,6 @@
package org.elasticsearch.action.admin.cluster.reroute;
import org.elasticsearch.Version;
import org.elasticsearch.action.support.master.AcknowledgedResponse;
import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.common.io.stream.StreamInput;
@ -54,13 +53,13 @@ public class ClusterRerouteResponse extends AcknowledgedResponse {
public void readFrom(StreamInput in) throws IOException {
super.readFrom(in);
state = ClusterState.Builder.readFrom(in, null);
readAcknowledged(in, Version.V_0_90_6);
readAcknowledged(in);
}
@Override
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
ClusterState.Builder.writeTo(state, out);
writeAcknowledged(out, Version.V_0_90_6);
writeAcknowledged(out);
}
}

View File

@ -19,7 +19,6 @@
package org.elasticsearch.action.admin.cluster.settings;
import org.elasticsearch.Version;
import org.elasticsearch.action.support.master.AcknowledgedResponse;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
@ -52,7 +51,7 @@ public class ClusterUpdateSettingsResponse extends AcknowledgedResponse {
super.readFrom(in);
transientSettings = ImmutableSettings.readSettingsFromStream(in);
persistentSettings = ImmutableSettings.readSettingsFromStream(in);
readAcknowledged(in, Version.V_0_90_6);
readAcknowledged(in);
}
public Settings getTransientSettings() {
@ -68,6 +67,6 @@ public class ClusterUpdateSettingsResponse extends AcknowledgedResponse {
super.writeTo(out);
ImmutableSettings.writeSettingsToStream(transientSettings, out);
ImmutableSettings.writeSettingsToStream(persistentSettings, out);
writeAcknowledged(out, Version.V_0_90_6);
writeAcknowledged(out);
}
}

View File

@ -40,12 +40,12 @@ public class CreateIndexResponse 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);
}
}

View File

@ -19,7 +19,6 @@
package org.elasticsearch.action.admin.indices.mapping.delete;
import org.elasticsearch.Version;
import org.elasticsearch.action.support.master.AcknowledgedResponse;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
@ -42,12 +41,12 @@ public class DeleteMappingResponse extends AcknowledgedResponse {
@Override
public void readFrom(StreamInput in) throws IOException {
super.readFrom(in);
readAcknowledged(in, Version.V_0_90_6);
readAcknowledged(in);
}
@Override
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
writeAcknowledged(out, Version.V_0_90_6);
writeAcknowledged(out);
}
}

View File

@ -19,7 +19,6 @@
package org.elasticsearch.action.admin.indices.settings.put;
import org.elasticsearch.Version;
import org.elasticsearch.action.support.master.AcknowledgedResponse;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
@ -41,12 +40,12 @@ public class UpdateSettingsResponse extends AcknowledgedResponse {
@Override
public void readFrom(StreamInput in) throws IOException {
super.readFrom(in);
readAcknowledged(in, Version.V_0_90_6);
readAcknowledged(in);
}
@Override
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
writeAcknowledged(out, Version.V_0_90_6);
writeAcknowledged(out);
}
}

View File

@ -18,7 +18,6 @@
*/
package org.elasticsearch.action.admin.indices.warmer.delete;
import org.elasticsearch.Version;
import org.elasticsearch.action.ActionRequestValidationException;
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.action.support.master.AcknowledgedRequest;

View File

@ -18,7 +18,6 @@
*/
package org.elasticsearch.action.support.master;
import org.elasticsearch.Version;
import org.elasticsearch.action.ActionResponse;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
@ -53,31 +52,13 @@ public abstract class AcknowledgedResponse extends ActionResponse {
* 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>.
*/
protected void readAcknowledged(StreamInput in, Version minVersion) throws IOException {
if (minVersion == null || in.getVersion().onOrAfter(minVersion)) {
acknowledged = in.readBoolean();
}
}
/**
* 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>.
*/
protected void writeAcknowledged(StreamOutput out, Version minVersion) throws IOException {
if (minVersion == null || out.getVersion().onOrAfter(minVersion)) {
out.writeBoolean(acknowledged);
}
}
}

View File

@ -20,7 +20,6 @@
package org.elasticsearch.cluster.metadata;
import org.elasticsearch.ElasticsearchIllegalStateException;
import org.elasticsearch.Version;
import org.elasticsearch.action.TimestampParsingException;
import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.Strings;

View File

@ -26,7 +26,6 @@ import com.carrotsearch.hppc.cursors.ObjectObjectCursor;
import com.google.common.base.Predicate;
import com.google.common.collect.*;
import org.elasticsearch.ElasticsearchIllegalArgumentException;
import org.elasticsearch.Version;
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.cluster.block.ClusterBlock;
import org.elasticsearch.cluster.block.ClusterBlockLevel;