- if(message.getRemovedCandidate().equals(currentOwner) || message.getRemainingCandidates().size() == 0){
- String entityType = EntityOwnersModel.entityTypeFromEntityPath(message.getEntityPath());
- writeNewOwner(message.getEntityPath(),
- newOwner(currentOwner, message.getRemainingCandidates(), entityOwnershipStatistics.byEntityType(entityType),
- getEntityOwnerElectionStrategy(message.getEntityPath())));
- }
- } else {
- // We're not the leader. If the removed candidate is our local member then check if we actually
- // have a local candidate registered. If we do then we must have been partitioned from the leader
- // and the leader removed our candidate since the leader can't tell the difference between a
- // temporary network partition and a node's process actually restarted. So, in that case, re-add
- // our candidate.
- if(localMemberName.equals(message.getRemovedCandidate()) &&
- listenerSupport.hasCandidateForEntity(createEntity(message.getEntityPath()))) {
- LOG.debug("Local candidate member was removed but a local candidate is registered for {}" +
- " - adding back local candidate", message.getEntityPath());
-
- commitCoordinator.commitModification(new MergeModification(
- candidatePath(message.getEntityPath(), localMemberName),
- candidateMapEntry(localMemberName)), this);
- }
+ writeNewOwner(message.getEntityPath(),
+ newOwner(currentOwner, message.getRemainingCandidates(),
+ getEntityOwnerElectionStrategy(message.getEntityPath())));