/* * The repsonding AL will be starting from zero state and thus would normally generate a * "permissive" LAST that permits the leader (also at zero state) to make a new proposal * immediately. We want the leader to have to clear out a previous proposal prior to that. So * we replace the "permissive" last, introducing a valid LAST that should cause the leader to * deliver up the included value and then re-propose(non-Javadoc) the original value above. */ public void send(Packet aPacket, InetSocketAddress anAddr) { if (_seenLast) _tp.send(aPacket, anAddr); else { if (aPacket.getMessage().getType() == PaxosMessage.Types.LAST) { ByteBuffer myBuffer = ByteBuffer.allocate(4); myBuffer.putInt(66); Last myOrig = (Last) aPacket.getMessage(); _seenLast = true; _tp.send( _tp.getPickler() .newPacket( new Last( myOrig.getSeqNum(), myOrig.getLowWatermark(), myOrig.getRndNumber() + 1, new Proposal("data", myBuffer.array()))), anAddr); } else { _tp.send(aPacket, anAddr); } } }
public Transport.PacketPickler getPickler() { return _tp.getPickler(); }