- public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
- in.readShort(); // raft version - not currently used
- setTerm(in.readLong());
- leaderId = in.readUTF();
- lastIncludedIndex = in.readLong();
- lastIncludedTerm = in.readLong();
- chunkIndex = in.readInt();
- totalChunks = in.readInt();
-
- lastChunkHashCode = Optional.absent();
- boolean chunkHashCodePresent = in.readByte() == 1;
- if(chunkHashCodePresent) {
- lastChunkHashCode = Optional.of(in.readInt());
+ public String toString() {
+ return "InstallSnapshot [term=" + getTerm() + ", leaderId=" + leaderId + ", lastIncludedIndex="
+ + lastIncludedIndex + ", lastIncludedTerm=" + lastIncludedTerm + ", datasize=" + data.length
+ + ", Chunk=" + chunkIndex + "/" + totalChunks + ", lastChunkHashCode=" + lastChunkHashCode
+ + ", serverConfig=" + serverConfig.orNull() + "]";
+ }
+
+ private Object writeReplace() {
+ return new Proxy(this);
+ }
+
+ private static class Proxy implements Externalizable {
+ private static final long serialVersionUID = 1L;
+
+ private InstallSnapshot installSnapshot;
+
+ // checkstyle flags the public modifier as redundant which really doesn't make sense since it clearly isn't
+ // redundant. It is explicitly needed for Java serialization to be able to create instances via reflection.
+ @SuppressWarnings("checkstyle:RedundantModifier")
+ public Proxy() {