/**
* Message class to persist election term information.
*/
-public class UpdateElectionTerm implements Serializable, MigratedSerializable {
+public class UpdateElectionTerm implements Serializable {
private static final class Proxy implements Externalizable {
private static final long serialVersionUID = 1L;
private UpdateElectionTerm updateElectionTerm;
+ // 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() {
// For Externalizable
}
public void writeExternal(final ObjectOutput out) throws IOException {
out.writeLong(updateElectionTerm.currentTerm);
out.writeObject(updateElectionTerm.votedFor);
- }
+ }
@Override
public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
private final long currentTerm;
private final String votedFor;
- private final boolean migrated;
- private UpdateElectionTerm(final long currentTerm, final String votedFor, final boolean migrated) {
+ public UpdateElectionTerm(final long currentTerm, final String votedFor) {
this.currentTerm = currentTerm;
this.votedFor = votedFor;
- this.migrated = migrated;
- }
-
- public UpdateElectionTerm(final long currentTerm, final String votedFor) {
- this(currentTerm, votedFor, false);
}
public long getCurrentTerm() {
return votedFor;
}
- @Override
- public boolean isMigrated() {
- return migrated;
- }
-
- @Override
- public Object writeReplace() {
+ private Object writeReplace() {
return new Proxy(this);
}
- @Deprecated
- public static UpdateElectionTerm createMigrated(final long currentTerm, final String votedFor) {
- return new UpdateElectionTerm(currentTerm, votedFor, true);
- }
-
@Override
public String toString() {
return "UpdateElectionTerm [currentTerm=" + currentTerm + ", votedFor=" + votedFor + "]";