{
case REPLY_OK_RS_SCENARIO:
if (updateMsg.isAssured())
{
// Send the ack without errors
AckMsg ackMsg = new AckMsg(updateMsg.getChangeNumber());
session.publish(ackMsg);
ackReplied = true;
}
break;
case TIMEOUT_RS_SCENARIO:
// Let timeout occur
break;
case DS_TIMEOUT_RS_SCENARIO_SAFE_READ:
if (updateMsg.isAssured())
{
// Emulate RS waiting for virtual DS ack
sleep(MAX_SEND_UPDATE_TIME);
// Send the ack with timeout error from a virtual DS with id (ours + 10)
AckMsg ackMsg = new AckMsg(updateMsg.getChangeNumber());
ackMsg.setHasTimeout(true);
List<Integer> failedServers = new ArrayList<Integer>();
failedServers.add(serverId + 10);
ackMsg.setFailedServers(failedServers);
session.publish(ackMsg);
ackReplied = true;
}
break;
case DS_WRONG_STATUS_RS_SCENARIO_SAFE_READ:
if (updateMsg.isAssured())
{
// Send the ack with wrong status error from a virtual DS with id (ours + 10)
AckMsg ackMsg = new AckMsg(updateMsg.getChangeNumber());
ackMsg.setHasWrongStatus(true);
List<Integer> failedServers = new ArrayList<Integer>();
failedServers.add((serverId + 10));
ackMsg.setFailedServers(failedServers);
session.publish(ackMsg);
ackReplied = true;
}
break;
case DS_REPLAY_ERROR_RS_SCENARIO_SAFE_READ:
if (updateMsg.isAssured())
{
// Send the ack with replay error from a virtual DS with id (ours + 10)
AckMsg ackMsg = new AckMsg(updateMsg.getChangeNumber());
ackMsg.setHasReplayError(true);
List<Integer> failedServers = new ArrayList<Integer>();
failedServers.add((serverId + 10));
ackMsg.setFailedServers(failedServers);
session.publish(ackMsg);
ackReplied = true;
}
break;
default: