package iotcloud;
import java.nio.ByteBuffer;
+import java.util.HashSet;
/**
* Entry for tracking messages that the server rejected. We have to
/* Is the machine identifier of the relevant slots equal to (or not
* equal to) the specified machine identifier. */
private boolean equalto;
+ /* Set of machines that have not received notification. */
+ private HashSet<Long> watchset;
RejectedMessage(Slot slot, long _machineid, long _oldseqnum, long _newseqnum, boolean _equalto) {
super(slot);
return new RejectedMessage(slot, machineid, oldseqnum, newseqnum, equalto==1);
}
+ void setWatchSet(HashSet<Long> _watchset) {
+ watchset=_watchset;
+ }
+
+ void removeWatcher(long machineid) {
+ if (watchset.remove(machineid))
+ if (watchset.isEmpty())
+ setDead();
+ }
+
void encode(ByteBuffer bb) {
bb.put(Entry.TypeRejectedMessage);
bb.putLong(machineid);