Class TxnBatchedPositionImpl

java.lang.Object
org.apache.bookkeeper.mledger.impl.PositionImpl
org.apache.pulsar.transaction.coordinator.impl.TxnBatchedPositionImpl
All Implemented Interfaces:
Comparable<org.apache.bookkeeper.mledger.impl.PositionImpl>, org.apache.bookkeeper.mledger.Position

public class TxnBatchedPositionImpl extends org.apache.bookkeeper.mledger.impl.PositionImpl
The difference with PositionImpl is that there are two more parameters: batchSize, batchIndex.
  • Field Summary

    Fields inherited from class org.apache.bookkeeper.mledger.impl.PositionImpl

    ackSet, EARLIEST, entryId, LATEST, ledgerId
  • Constructor Summary

    Constructors
    Constructor
    Description
    TxnBatchedPositionImpl(long ledgerId, long entryId, int batchSize, int batchIndex)
     
    TxnBatchedPositionImpl(org.apache.bookkeeper.mledger.Position position, int batchSize, int batchIndex)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    compareTo(org.apache.bookkeeper.mledger.impl.PositionImpl that)
    It's exactly the same as PositionImpl,to make sure that when compare to the "markDeletePosition", it looks like PositionImpl.
    boolean
    It's exactly the same as PositionImpl,make sure that when TxnBatchedPositionImpl used as the key of map same as PositionImpl.
    int
    It's exactly the same as PositionImpl,make sure that when TxnBatchedPositionImpl used as the key of map same as PositionImpl.
    void
    Build the attribute ackSet to that batchIndex is false and others is true.

    Methods inherited from class org.apache.bookkeeper.mledger.impl.PositionImpl

    compareTo, get, get, get, getAckSet, getEntryId, getLedgerId, getNext, getPositionInfo, hasAckSet, setAckSet, toString

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • TxnBatchedPositionImpl

      public TxnBatchedPositionImpl(long ledgerId, long entryId, int batchSize, int batchIndex)
    • TxnBatchedPositionImpl

      public TxnBatchedPositionImpl(org.apache.bookkeeper.mledger.Position position, int batchSize, int batchIndex)
  • Method Details

    • equals

      public boolean equals(Object o)
      It's exactly the same as PositionImpl,make sure that when TxnBatchedPositionImpl used as the key of map same as PositionImpl. batchSize and batchIndex should not be involved in calculate, just like PositionImpl.ackSet is not involved in calculate. Note: In ConcurrentSkipListMap, it use the Comparable.compareTo(Object) to determine whether the keys are the same. In HashMap, it use the Object.hashCode() & Object.equals(Object) to determine whether the keys are the same.
      Overrides:
      equals in class org.apache.bookkeeper.mledger.impl.PositionImpl
    • hashCode

      public int hashCode()
      It's exactly the same as PositionImpl,make sure that when TxnBatchedPositionImpl used as the key of map same as PositionImpl. batchSize and batchIndex should not be involved in calculate, just like PositionImpl.ackSet is not involved in calculate. Note: In ConcurrentSkipListMap, it use the Comparable.compareTo(Object) to determine whether the keys are the same. In HashMap, it use the Object.hashCode() & Object.equals(Object) to determine whether the keys are the same.
      Overrides:
      hashCode in class org.apache.bookkeeper.mledger.impl.PositionImpl
    • compareTo

      public int compareTo(org.apache.bookkeeper.mledger.impl.PositionImpl that)
      It's exactly the same as PositionImpl,to make sure that when compare to the "markDeletePosition", it looks like PositionImpl. batchSize and batchIndex should not be involved in calculate, just like PositionImpl.ackSet is not involved in calculate. Note: In ConcurrentSkipListMap, it use the Comparable.compareTo(Object) to determine whether the keys are the same. In HashMap, it use the Object.hashCode() & Object.equals(Object) to determine whether the keys are the same.
      Specified by:
      compareTo in interface Comparable<org.apache.bookkeeper.mledger.impl.PositionImpl>
      Overrides:
      compareTo in class org.apache.bookkeeper.mledger.impl.PositionImpl
    • setAckSetByIndex

      public void setAckSetByIndex()
      Build the attribute ackSet to that batchIndex is false and others is true.