Class V2Batch

  • All Implemented Interfaces:
    Iterable<Message>, Batch

    public class V2Batch
    extends Object
    implements Batch
    Implementation of Batch for the v2 protocol backed by ByteBuf. *must* be released after use.
    • Constructor Detail

      • V2Batch

        public V2Batch()
    • Method Detail

      • setProtocol

        public void setProtocol​(byte protocol)
      • getProtocol

        public byte getProtocol()
        Description copied from interface: Batch
        Returns the protocol of the sent messages that this batch was constructed from
        Specified by:
        getProtocol in interface Batch
        Returns:
        byte - either '1' or '2'
      • getBatchSize

        public int getBatchSize()
        Description copied from interface: Batch
        Number of messages that the batch is expected to contain.
        Specified by:
        getBatchSize in interface Batch
        Returns:
        int - number of messages
      • setBatchSize

        public void setBatchSize​(int batchSize)
        Description copied from interface: Batch
        Set the number of messages that the batch is expected to contain.
        Specified by:
        setBatchSize in interface Batch
        Parameters:
        batchSize - int - number of messages
      • size

        public int size()
        Description copied from interface: Batch
        Current number of messages in the batch
        Specified by:
        size in interface Batch
        Returns:
        int
      • isEmpty

        public boolean isEmpty()
        Description copied from interface: Batch
        Is the batch currently empty?
        Specified by:
        isEmpty in interface Batch
        Returns:
        boolean
      • isComplete

        public boolean isComplete()
        Description copied from interface: Batch
        Is the batch complete?
        Specified by:
        isComplete in interface Batch
        Returns:
        boolean
      • getHighestSequence

        public int getHighestSequence()
        Description copied from interface: Batch
        Returns the highest sequence number of the batch.
        Specified by:
        getHighestSequence in interface Batch
        Returns:
      • release

        public void release()
        Description copied from interface: Batch
        Release the resources associated with the batch. Consumers of the batch *must* release after use.
        Specified by:
        release in interface Batch