Class AmqpTransferTagGenerator


  • public final class AmqpTransferTagGenerator
    extends Object
    Utility class that can generate and if enabled pool the binary tag values used to identify transfers over an AMQP link.
    • Field Detail

    • Constructor Detail

      • AmqpTransferTagGenerator

        public AmqpTransferTagGenerator()
      • AmqpTransferTagGenerator

        public AmqpTransferTagGenerator​(boolean pool)
    • Method Detail

      • getNextTag

        public byte[] getNextTag()
        Retrieves the next available tag.
        Returns:
        a new or unused tag depending on the pool option.
      • returnTag

        public void returnTag​(byte[] data)
        When used as a pooled cache of tags the unused tags should always be returned once the transfer has been settled.
        Parameters:
        data - a previously borrowed tag that is no longer in use.
      • getMaxPoolSize

        public int getMaxPoolSize()
        Gets the current max pool size value.
        Returns:
        the current max tag pool size.
      • setMaxPoolSize

        public void setMaxPoolSize​(int maxPoolSize)
        Sets the max tag pool size. If the size is smaller than the current number of pooled tags the pool will drain over time until it matches the max.
        Parameters:
        maxPoolSize - the maximum number of tags to hold in the pool.
      • isPooling

        public boolean isPooling()
        Returns:
        true if the generator is using a pool of tags to reduce allocations.