/** * Adds a new message to the hash table. * * @param seqno The sequence number associated with the message * @param msg The message (should be a copy!) * @param receivers The set of addresses to which the message was sent * and from which consequently an ACK is expected */ public void add(long seqno, Message msg, Vector receivers) { Entry e; if (waiting) return; if (receivers.size() == 0) return; synchronized(msgs) { if (msgs.get(Long.valueOf(seqno)) != null) return; e = new Entry(seqno, msg, receivers, retransmit_intervals); msgs.put(Long.valueOf(seqno), e); retransmitter.add(e); } }
/** * Remove all pending msgs from the hashtable. Cancel all associated * tasks in the retransmission scheduler */ public void reset() { Entry entry; if (waiting) return; synchronized(msgs) { for (Enumeration e = msgs.elements(); e.hasMoreElements();) { entry = (Entry)e.nextElement(); entry.cancel(); } msgs.clear(); msgs.notifyAll(); } }
/** Prints all members plus whether an ack has been received from those members for a given seqno */ public String printDetails(long seqno) { Entry entry=(Entry)msgs.get(Long.valueOf(seqno)); if(entry != null) return entry.toString(); else return null; }
for (Enumeration e = msgs.elements(); e.hasMoreElements();) { entry = (Entry)e.nextElement(); entry.cancel();
if (!entry.allReceived()) return; entry.cancel(); msgs.remove(Long.valueOf(seqno)); stable_msgs.add(Long.valueOf(seqno));
if(received == null) continue; // suspected member not in entry.senders ? if (received.booleanValue()) entry.num_received--; if (!entry.allReceived()) continue; entry.cancel(); msgs.remove(key); stable_msgs.add(key);