Don't implement Serializable in core classes
We can't add this to forbidden API since literally everything implements this. Any API that would for instance use a String would not compile anymore.
This commit is contained in:
parent
e7eb9cf4de
commit
fa016a2b09
|
@ -21,22 +21,14 @@ package org.elasticsearch.action;
|
|||
|
||||
import org.elasticsearch.common.io.stream.Streamable;
|
||||
import org.elasticsearch.common.xcontent.ToXContent;
|
||||
import org.elasticsearch.index.Index;
|
||||
import org.elasticsearch.index.IndexException;
|
||||
import org.elasticsearch.rest.RestStatus;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* An exception indicating that a failure occurred performing an operation on the shard.
|
||||
*
|
||||
*
|
||||
*/
|
||||
public interface ShardOperationFailedException extends Streamable, Serializable, ToXContent {
|
||||
public interface ShardOperationFailedException extends Streamable, ToXContent {
|
||||
|
||||
/**
|
||||
* The index the operation failed on. Might return <tt>null</tt> if it can't be derived.
|
||||
|
|
|
@ -28,9 +28,8 @@ import org.elasticsearch.common.xcontent.XContentBuilder;
|
|||
import org.elasticsearch.common.xcontent.XContentBuilderString;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
|
||||
public class PluginInfo implements Streamable, Serializable, ToXContent {
|
||||
public class PluginInfo implements Streamable, ToXContent {
|
||||
public static final String DESCRIPTION_NOT_AVAILABLE = "No description found.";
|
||||
public static final String VERSION_NOT_AVAILABLE = "NA";
|
||||
|
||||
|
|
|
@ -27,11 +27,10 @@ import org.elasticsearch.common.xcontent.XContentBuilder;
|
|||
import org.elasticsearch.common.xcontent.XContentBuilderString;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class PluginsInfo implements Streamable, Serializable, ToXContent {
|
||||
public class PluginsInfo implements Streamable, ToXContent {
|
||||
static final class Fields {
|
||||
static final XContentBuilderString PLUGINS = new XContentBuilderString("plugins");
|
||||
}
|
||||
|
|
|
@ -27,7 +27,6 @@ import org.elasticsearch.common.xcontent.XContentBuilder;
|
|||
import org.elasticsearch.rest.RestStatus;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
import java.util.Locale;
|
||||
|
@ -35,7 +34,7 @@ import java.util.Locale;
|
|||
/**
|
||||
*
|
||||
*/
|
||||
public class ClusterBlock implements Serializable, Streamable, ToXContent {
|
||||
public class ClusterBlock implements Streamable, ToXContent {
|
||||
|
||||
private int id;
|
||||
|
||||
|
|
|
@ -24,12 +24,11 @@ import org.elasticsearch.common.io.stream.StreamOutput;
|
|||
import org.elasticsearch.common.io.stream.Streamable;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Snapshot ID - repository name + snapshot name
|
||||
*/
|
||||
public class SnapshotId implements Serializable, Streamable {
|
||||
public class SnapshotId implements Streamable {
|
||||
|
||||
private String repository;
|
||||
|
||||
|
|
|
@ -31,7 +31,6 @@ import org.elasticsearch.common.transport.TransportAddress;
|
|||
import org.elasticsearch.common.transport.TransportAddressSerializers;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.elasticsearch.common.transport.TransportAddressSerializers.addressToStream;
|
||||
|
|
|
@ -27,7 +27,6 @@ import org.elasticsearch.common.io.stream.StreamOutput;
|
|||
import org.elasticsearch.common.io.stream.Streamable;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -39,7 +38,7 @@ import static com.google.common.collect.Maps.newHashMap;
|
|||
* Encapsulates the result of a routing table validation and provides access to
|
||||
* validation failures.
|
||||
*/
|
||||
public class RoutingTableValidation implements Serializable, Streamable {
|
||||
public class RoutingTableValidation implements Streamable {
|
||||
|
||||
private boolean valid = true;
|
||||
|
||||
|
|
|
@ -29,7 +29,6 @@ import org.elasticsearch.common.xcontent.XContentBuilder;
|
|||
import org.elasticsearch.index.shard.ShardId;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -37,7 +36,7 @@ import java.util.List;
|
|||
* {@link ShardRouting} immutably encapsulates information about shard
|
||||
* routings like id, state, version, etc.
|
||||
*/
|
||||
public final class ShardRouting implements Streamable, Serializable, ToXContent {
|
||||
public final class ShardRouting implements Streamable, ToXContent {
|
||||
|
||||
protected String index;
|
||||
|
||||
|
|
|
@ -488,7 +488,7 @@ public abstract class StreamInput extends InputStream {
|
|||
case 0:
|
||||
return (T) ElasticsearchException.readException(this);
|
||||
case 1:
|
||||
// nocommit - this sucks it would be nice to have a better way to construct those?
|
||||
// this sucks it would be nice to have a better way to construct those?
|
||||
String msg = readOptionalString();
|
||||
final int idx = msg.indexOf(" (resource=");
|
||||
String resource = msg.substring(idx + " (resource=".length(), msg.length()-1);
|
||||
|
@ -520,7 +520,7 @@ public abstract class StreamInput extends InputStream {
|
|||
return (T) ElasticsearchException.readStackTrace(new EOFException(eofMessage), this);
|
||||
case 9:
|
||||
return (T) ElasticsearchException.readStackTrace(new SecurityException(readOptionalString(), readThrowable()), this);
|
||||
case 10: // unknown -- // nocommit - should we use a dedicated exception
|
||||
case 10: // unknown -- // C - should we use a dedicated exception
|
||||
return (T) ElasticsearchException.readStackTrace(new ElasticsearchException(readOptionalString(), readThrowable()), this);
|
||||
default:
|
||||
assert false : "no such exception for id: " + key;
|
||||
|
|
|
@ -20,14 +20,13 @@ package org.elasticsearch.common.text;
|
|||
|
||||
import org.elasticsearch.common.bytes.BytesReference;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Text represents a (usually) long text data. We use this abstraction instead of {@link String}
|
||||
* so we can represent it in a more optimized manner in memory as well as serializing it over the
|
||||
* network as well as converting it to json format.
|
||||
*/
|
||||
public interface Text extends Comparable<Text>, Serializable {
|
||||
public interface Text extends Comparable<Text> {
|
||||
|
||||
/**
|
||||
* Are bytes available without the need to be converted into bytes when calling {@link #bytes()}.
|
||||
|
|
|
@ -21,7 +21,6 @@ package org.elasticsearch.common.transport;
|
|||
|
||||
import org.elasticsearch.common.io.stream.Streamable;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
|
@ -28,11 +28,10 @@ import org.elasticsearch.common.io.stream.Streamable;
|
|||
import org.elasticsearch.common.settings.Settings;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
|
||||
public class ByteSizeValue implements Serializable, Streamable {
|
||||
public class ByteSizeValue implements Streamable {
|
||||
|
||||
private long size;
|
||||
|
||||
|
|
|
@ -27,12 +27,11 @@ import org.elasticsearch.common.io.stream.StreamOutput;
|
|||
import org.elasticsearch.common.io.stream.Streamable;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class SizeValue implements Serializable, Streamable {
|
||||
public class SizeValue implements Streamable {
|
||||
|
||||
private long size;
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ import java.util.Locale;
|
|||
import java.util.Objects;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class TimeValue implements Serializable, Streamable {
|
||||
public class TimeValue implements Streamable {
|
||||
|
||||
/** How many nano-seconds in one milli-second */
|
||||
public static final long NSEC_PER_MSEC = 1000000;
|
||||
|
|
|
@ -29,12 +29,11 @@ import org.elasticsearch.common.xcontent.XContentBuilder;
|
|||
import org.elasticsearch.common.xcontent.XContentBuilderString;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class HttpInfo implements Streamable, Serializable, ToXContent {
|
||||
public class HttpInfo implements Streamable, ToXContent {
|
||||
|
||||
private BoundTransportAddress address;
|
||||
private long maxContentLength;
|
||||
|
|
|
@ -24,12 +24,11 @@ import org.elasticsearch.common.io.stream.StreamOutput;
|
|||
import org.elasticsearch.common.io.stream.Streamable;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class Index implements Serializable, Streamable {
|
||||
public class Index implements Streamable {
|
||||
|
||||
private String name;
|
||||
|
||||
|
|
|
@ -25,12 +25,11 @@ import org.elasticsearch.common.io.stream.Streamable;
|
|||
import org.elasticsearch.index.Index;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Allows for shard level components to be injected with the shard id.
|
||||
*/
|
||||
public class ShardId implements Serializable, Streamable, Comparable<ShardId> {
|
||||
public class ShardId implements Streamable, Comparable<ShardId> {
|
||||
|
||||
private Index index;
|
||||
|
||||
|
|
|
@ -51,14 +51,13 @@ import org.elasticsearch.index.suggest.stats.SuggestStats;
|
|||
import org.elasticsearch.search.suggest.completion.CompletionStats;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Global information on indices stats running on a specific node.
|
||||
*/
|
||||
public class NodeIndicesStats implements Streamable, Serializable, ToXContent {
|
||||
public class NodeIndicesStats implements Streamable, ToXContent {
|
||||
|
||||
private CommonStats stats;
|
||||
private Map<Index, List<IndexShardStats>> statsByShard;
|
||||
|
|
|
@ -29,7 +29,6 @@ import org.elasticsearch.common.xcontent.XContentBuilder;
|
|||
import org.elasticsearch.common.xcontent.XContentBuilderString;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.lang.management.*;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
@ -38,7 +37,7 @@ import java.util.Map;
|
|||
/**
|
||||
*
|
||||
*/
|
||||
public class JvmInfo implements Streamable, Serializable, ToXContent {
|
||||
public class JvmInfo implements Streamable, ToXContent {
|
||||
|
||||
private static JvmInfo INSTANCE;
|
||||
|
||||
|
@ -349,7 +348,7 @@ public class JvmInfo implements Streamable, Serializable, ToXContent {
|
|||
out.writeStringArray(memoryPools);
|
||||
}
|
||||
|
||||
public static class Mem implements Streamable, Serializable {
|
||||
public static class Mem implements Streamable {
|
||||
|
||||
long heapInit = 0;
|
||||
long heapMax = 0;
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
package org.elasticsearch.monitor.jvm;
|
||||
|
||||
import com.google.common.collect.Iterators;
|
||||
import org.elasticsearch.common.Booleans;
|
||||
import org.elasticsearch.common.io.stream.StreamInput;
|
||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||
import org.elasticsearch.common.io.stream.Streamable;
|
||||
|
@ -31,19 +30,16 @@ import org.elasticsearch.common.xcontent.XContentBuilder;
|
|||
import org.elasticsearch.common.xcontent.XContentBuilderString;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.lang.management.*;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class JvmStats implements Streamable, Serializable, ToXContent {
|
||||
public class JvmStats implements Streamable, ToXContent {
|
||||
|
||||
private final static RuntimeMXBean runtimeMXBean;
|
||||
private final static MemoryMXBean memoryMXBean;
|
||||
|
@ -318,7 +314,7 @@ public class JvmStats implements Streamable, Serializable, ToXContent {
|
|||
}
|
||||
}
|
||||
|
||||
public static class GarbageCollectors implements Streamable, Serializable, Iterable<GarbageCollector> {
|
||||
public static class GarbageCollectors implements Streamable, Iterable<GarbageCollector> {
|
||||
|
||||
GarbageCollector[] collectors;
|
||||
|
||||
|
@ -357,7 +353,7 @@ public class JvmStats implements Streamable, Serializable, ToXContent {
|
|||
}
|
||||
}
|
||||
|
||||
public static class GarbageCollector implements Streamable, Serializable {
|
||||
public static class GarbageCollector implements Streamable {
|
||||
|
||||
String name;
|
||||
long collectionCount;
|
||||
|
@ -399,7 +395,7 @@ public class JvmStats implements Streamable, Serializable, ToXContent {
|
|||
}
|
||||
}
|
||||
|
||||
public static class Threads implements Streamable, Serializable {
|
||||
public static class Threads implements Streamable {
|
||||
|
||||
int count;
|
||||
int peakCount;
|
||||
|
@ -434,7 +430,7 @@ public class JvmStats implements Streamable, Serializable, ToXContent {
|
|||
}
|
||||
}
|
||||
|
||||
public static class MemoryPool implements Streamable, Serializable {
|
||||
public static class MemoryPool implements Streamable {
|
||||
|
||||
String name;
|
||||
long used;
|
||||
|
@ -500,7 +496,7 @@ public class JvmStats implements Streamable, Serializable, ToXContent {
|
|||
}
|
||||
}
|
||||
|
||||
public static class Mem implements Streamable, Serializable, Iterable<MemoryPool> {
|
||||
public static class Mem implements Streamable, Iterable<MemoryPool> {
|
||||
|
||||
long heapCommitted;
|
||||
long heapUsed;
|
||||
|
|
|
@ -27,12 +27,11 @@ import org.elasticsearch.common.xcontent.XContentBuilder;
|
|||
import org.elasticsearch.common.xcontent.XContentBuilderString;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class NetworkInfo implements Streamable, Serializable, ToXContent {
|
||||
public class NetworkInfo implements Streamable, ToXContent {
|
||||
|
||||
public static final Interface NA_INTERFACE = new Interface();
|
||||
|
||||
|
@ -99,7 +98,7 @@ public class NetworkInfo implements Streamable, Serializable, ToXContent {
|
|||
primary.writeTo(out);
|
||||
}
|
||||
|
||||
public static class Interface implements Streamable, Serializable {
|
||||
public static class Interface implements Streamable {
|
||||
|
||||
private String name = "";
|
||||
private String address = "";
|
||||
|
|
|
@ -27,12 +27,11 @@ import org.elasticsearch.common.xcontent.XContentBuilder;
|
|||
import org.elasticsearch.common.xcontent.XContentBuilderString;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class NetworkStats implements Streamable, Serializable, ToXContent {
|
||||
public class NetworkStats implements Streamable, ToXContent {
|
||||
|
||||
long timestamp;
|
||||
|
||||
|
@ -119,7 +118,7 @@ public class NetworkStats implements Streamable, Serializable, ToXContent {
|
|||
return tcp();
|
||||
}
|
||||
|
||||
public static class Tcp implements Serializable, Streamable {
|
||||
public static class Tcp implements Streamable {
|
||||
|
||||
long activeOpens;
|
||||
long passiveOpens;
|
||||
|
|
|
@ -28,12 +28,11 @@ import org.elasticsearch.common.xcontent.XContentBuilder;
|
|||
import org.elasticsearch.common.xcontent.XContentBuilderString;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class OsInfo implements Streamable, Serializable, ToXContent {
|
||||
public class OsInfo implements Streamable, ToXContent {
|
||||
|
||||
long refreshInterval;
|
||||
|
||||
|
@ -188,7 +187,7 @@ public class OsInfo implements Streamable, Serializable, ToXContent {
|
|||
}
|
||||
}
|
||||
|
||||
public static class Swap implements Streamable, Serializable {
|
||||
public static class Swap implements Streamable {
|
||||
|
||||
long total = -1;
|
||||
|
||||
|
@ -222,7 +221,7 @@ public class OsInfo implements Streamable, Serializable, ToXContent {
|
|||
|
||||
}
|
||||
|
||||
public static class Mem implements Streamable, Serializable {
|
||||
public static class Mem implements Streamable {
|
||||
|
||||
long total = -1;
|
||||
|
||||
|
@ -256,7 +255,7 @@ public class OsInfo implements Streamable, Serializable, ToXContent {
|
|||
|
||||
}
|
||||
|
||||
public static class Cpu implements Streamable, Serializable, ToXContent {
|
||||
public static class Cpu implements Streamable, ToXContent {
|
||||
|
||||
String vendor = "";
|
||||
String model = "";
|
||||
|
|
|
@ -29,13 +29,12 @@ import org.elasticsearch.common.xcontent.XContentBuilder;
|
|||
import org.elasticsearch.common.xcontent.XContentBuilderString;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class OsStats implements Streamable, Serializable, ToXContent {
|
||||
public class OsStats implements Streamable, ToXContent {
|
||||
|
||||
public static final double[] EMPTY_LOAD = new double[0];
|
||||
|
||||
|
@ -249,7 +248,7 @@ public class OsStats implements Streamable, Serializable, ToXContent {
|
|||
}
|
||||
}
|
||||
|
||||
public static class Swap implements Streamable, Serializable {
|
||||
public static class Swap implements Streamable {
|
||||
|
||||
long free = -1;
|
||||
long used = -1;
|
||||
|
@ -289,7 +288,7 @@ public class OsStats implements Streamable, Serializable, ToXContent {
|
|||
}
|
||||
}
|
||||
|
||||
public static class Mem implements Streamable, Serializable {
|
||||
public static class Mem implements Streamable {
|
||||
|
||||
long free = -1;
|
||||
short freePercent = -1;
|
||||
|
@ -373,7 +372,7 @@ public class OsStats implements Streamable, Serializable, ToXContent {
|
|||
}
|
||||
}
|
||||
|
||||
public static class Cpu implements Streamable, Serializable {
|
||||
public static class Cpu implements Streamable {
|
||||
|
||||
short sys = -1;
|
||||
short user = -1;
|
||||
|
|
|
@ -28,12 +28,11 @@ import org.elasticsearch.common.xcontent.XContentBuilder;
|
|||
import org.elasticsearch.common.xcontent.XContentBuilderString;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class ProcessInfo implements Streamable, Serializable, ToXContent {
|
||||
public class ProcessInfo implements Streamable, ToXContent {
|
||||
|
||||
long refreshInterval;
|
||||
|
||||
|
|
|
@ -29,12 +29,11 @@ import org.elasticsearch.common.xcontent.XContentBuilder;
|
|||
import org.elasticsearch.common.xcontent.XContentBuilderString;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class ProcessStats implements Streamable, Serializable, ToXContent {
|
||||
public class ProcessStats implements Streamable, ToXContent {
|
||||
|
||||
long timestamp = -1;
|
||||
|
||||
|
@ -162,7 +161,7 @@ public class ProcessStats implements Streamable, Serializable, ToXContent {
|
|||
}
|
||||
}
|
||||
|
||||
public static class Mem implements Streamable, Serializable {
|
||||
public static class Mem implements Streamable {
|
||||
|
||||
long totalVirtual = -1;
|
||||
long resident = -1;
|
||||
|
@ -216,7 +215,7 @@ public class ProcessStats implements Streamable, Serializable, ToXContent {
|
|||
}
|
||||
}
|
||||
|
||||
public static class Cpu implements Streamable, Serializable {
|
||||
public static class Cpu implements Streamable {
|
||||
|
||||
short percent = -1;
|
||||
long sys = -1;
|
||||
|
|
|
@ -27,12 +27,11 @@ import org.elasticsearch.common.text.StringAndBytesText;
|
|||
import org.elasticsearch.common.text.Text;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* The target that the search request was executed on.
|
||||
*/
|
||||
public class SearchShardTarget implements Streamable, Serializable, Comparable<SearchShardTarget> {
|
||||
public class SearchShardTarget implements Streamable, Comparable<SearchShardTarget> {
|
||||
|
||||
private Text nodeId;
|
||||
private Text index;
|
||||
|
|
|
@ -30,13 +30,12 @@ import org.elasticsearch.common.xcontent.XContentBuilder;
|
|||
import org.elasticsearch.common.xcontent.XContentBuilderString;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class TransportInfo implements Streamable, Serializable, ToXContent {
|
||||
public class TransportInfo implements Streamable, ToXContent {
|
||||
|
||||
private BoundTransportAddress address;
|
||||
private Map<String, BoundTransportAddress> profileAddresses;
|
||||
|
|
Loading…
Reference in New Issue