Class AmqpTransferTagGenerator
- java.lang.Object
-
- org.apache.activemq.transport.amqp.protocol.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 Summary
Fields Modifier and Type Field Description static int
DEFAULT_TAG_POOL_SIZE
-
Constructor Summary
Constructors Constructor Description AmqpTransferTagGenerator()
AmqpTransferTagGenerator(boolean pool)
-
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.
-
-
-
Field Detail
-
DEFAULT_TAG_POOL_SIZE
public static final int DEFAULT_TAG_POOL_SIZE
- See Also:
- Constant Field Values
-
-
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.
-
-