Class AmqpTransferTagGenerator
java.lang.Object
org.apache.qpid.jms.provider.amqp.AmqpTransferTagGenerator
Utility class that can generate and if enabled pool the binary tag values
used to identify transfers over an AMQP link.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintGets the current max pool size value.byte[]Retrieves the next available tag.booleanvoidreturnTag(byte[] data) When used as a pooled cache of tags the unused tags should always be returned once the transfer has been settled.voidsetMaxPoolSize(int maxPoolSize) Sets the max tag pool size.
-
Field Details
-
DEFAULT_TAG_POOL_SIZE
public static final int DEFAULT_TAG_POOL_SIZE- See Also:
-
-
Constructor Details
-
AmqpTransferTagGenerator
public AmqpTransferTagGenerator() -
AmqpTransferTagGenerator
public AmqpTransferTagGenerator(boolean pool)
-
-
Method Details
-
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.
-