Class AmqpTransferTagGenerator


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

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getMaxPoolSize()
      Gets the current max pool size value.
      byte[] getNextTag()
      Retrieves the next available tag.
      boolean isPooling()  
      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.
      void setMaxPoolSize​(int maxPoolSize)
      Sets the max tag pool size.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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.