RejectedMessage rm=new RejectedMessage(s, localmachineid, old_seqn, new_seqn, false);
s.addEntry(rm);
} else {
- long prev_seqn=old_seqn;
- for(int i=0; i<rejectedmessagelist.size();i++) {
+ long prev_seqn=-1;
+ int i=0;
+ /* Go through list of missing messages */
+ for(;i<rejectedmessagelist.size();i++) {
long curr_seqn=rejectedmessagelist.get(i);
Slot s_msg=buffer.getSlot(curr_seqn);
- if (s_msg!=null) {
- long machineid=s_msg.getMachineID();
- RejectedMessage rm=new RejectedMessage(s, machineid, curr_seqn, curr_seqn, true);
- s.addEntry(rm);
- if (old_seqn != -1 && old_seqn != curr_seqn) {
- RejectedMessage rmprev=new RejectedMessage(s, localmachineid, old_seqn, prev_seqn, false);
- s.addEntry(rmprev);
- }
- old_seqn = -1;
- } else {
- prev_seqn=curr_seqn;
- }
+ if (s_msg!=null)
+ break;
+ prev_seqn=curr_seqn;
}
- if (old_seqn != -1) {
+ /* Generate rejected message entry for missing messages */
+ if (prev_seqn != -1) {
RejectedMessage rm=new RejectedMessage(s, localmachineid, old_seqn, prev_seqn, false);
s.addEntry(rm);
}
+ /* Generate rejected message entries for present messages */
+ for(;i<rejectedmessagelist.size();i++) {
+ long curr_seqn=rejectedmessagelist.get(i);
+ Slot s_msg=buffer.getSlot(curr_seqn);
+ long machineid=s_msg.getMachineID();
+ RejectedMessage rm=new RejectedMessage(s, machineid, curr_seqn, curr_seqn, true);
+ s.addEntry(rm);
+ }
}
}