Exemplo n.º 1
0
      /*
       * 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);
          }
        }
      }
Exemplo n.º 2
0
 public InetSocketAddress getBroadcastAddress() {
   return _tp.getBroadcastAddress();
 }
Exemplo n.º 3
0
 public InetSocketAddress getLocalAddress() {
   return _tp.getLocalAddress();
 }
Exemplo n.º 4
0
 public void routeTo(Dispatcher aDispatcher) throws Exception {
   _tp.routeTo(aDispatcher);
 }
Exemplo n.º 5
0
 public FailureDetector getFD() {
   return _tp.getFD();
 }
Exemplo n.º 6
0
 public Transport.PacketPickler getPickler() {
   return _tp.getPickler();
 }