* @param oldParticipantId the participant to drop
* @param newParticipantId the participant that takes its place
* @return true if swap successful, false otherwise
*/
public boolean swapParticipants(ParticipantId oldParticipantId, ParticipantId newParticipantId) {
Participant oldParticipant = readParticipant(oldParticipantId);
if (oldParticipant == null) {
LOG.error("Could not swap participants because the old participant does not exist");
return false;
}
if (oldParticipant.isEnabled()) {
LOG.error("Could not swap participants because the old participant is still enabled");
return false;
}
if (oldParticipant.isAlive()) {
LOG.error("Could not swap participants because the old participant is still live");
return false;
}
Participant newParticipant = readParticipant(newParticipantId);
if (newParticipant == null) {
LOG.error("Could not swap participants because the new participant does not exist");
return false;
}
dropParticipant(oldParticipantId);