3 import java.nio.ByteBuffer;
6 * This Entry records the last message sent by a given machine.
7 * @author Brian Demsky <bdemsky@uci.edu>
12 class LastMessage extends Entry {
13 private long machineid;
16 public LastMessage(Slot slot, long _machineid, long _seqnum) {
22 public long getMachineID() {
26 public long getSequenceNumber() {
30 static Entry decode(Slot slot, ByteBuffer bb) {
31 long machineid=bb.getLong();
32 long seqnum=bb.getLong();
33 return new LastMessage(slot, machineid, seqnum);
36 public void encode(ByteBuffer bb) {
37 bb.put(Entry.TypeLastMessage);
38 bb.putLong(machineid);
42 public int getSize() {
43 //return 2*Long.BYTES+Byte.BYTES;
44 return 2*Long.SIZE/8+Byte.SIZE/8;
47 public byte getType() {
48 return Entry.TypeLastMessage;
51 public Entry getCopy(Slot s) {
52 return new LastMessage(s, machineid, seqnum);