import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Objects;
import com.google.common.base.Optional;
-import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;
import java.io.Serializable;
import java.util.Collection;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
.snapshotIndex(replicatedLog().getSnapshotIndex())
.snapshotTerm(replicatedLog().getSnapshotTerm())
.votedFor(context.getTermInformation().getVotedFor())
- .peerAddresses(ImmutableMap.copyOf(context.getPeerAddresses()));
+ .peerAddresses(new HashMap<>(context.getPeerAddresses()));
ReplicatedLogEntry lastLogEntry = getLastLogEntry();
if (lastLogEntry != null) {
Optional<ActorRef> roleChangeNotifier = getRoleChangeNotifier();
if(!Objects.equal(oldBehaviorLeaderId, currentBehavior.getLeaderId())) {
if(roleChangeNotifier.isPresent()) {
- roleChangeNotifier.get().tell(new LeaderStateChanged(getId(), currentBehavior.getLeaderId()), getSelf());
+ roleChangeNotifier.get().tell(newLeaderStateChanged(getId(), currentBehavior.getLeaderId()), getSelf());
}
onLeaderChanged(oldBehaviorLeaderId, currentBehavior.getLeaderId());
}
}
+ protected LeaderStateChanged newLeaderStateChanged(String memberId, String leaderId) {
+ return new LeaderStateChanged(memberId, leaderId);
+ }
+
/**
* When a derived RaftActor needs to persist something it must call
* persistData.
* whose type for fromIndex is long instead of int. This class was kept for backwards
* compatibility with Helium.
*/
+ // Suppressing this warning as we can't set serialVersionUID to maintain backwards compatibility.
+ @SuppressWarnings("serial")
@Deprecated
static class DeleteEntries implements Serializable {
- private static final long serialVersionUID = 1L;
private final int fromIndex;
public DeleteEntries(int fromIndex) {
}
}
+ // Suppressing this warning as we can't set serialVersionUID to maintain backwards compatibility.
+ @SuppressWarnings("serial")
static class UpdateElectionTerm implements Serializable {
- private static final long serialVersionUID = 1L;
private final long currentTerm;
private final String votedFor;