This is an automated email from the ASF dual-hosted git repository.
tabish121 pushed a commit to branch 1.x
in repository https://gitbox.apache.org/repos/asf/qpid-protonj2.git
The following commit(s) were added to refs/heads/1.x by this push:
new 7ef95711 PROTON-2956 Delivery tag at pool index 256 is not unique
7ef95711 is described below
commit 7ef957115006b73c51f0aff0868e8144fb71adad
Author: Daniil Kirilyuk <[email protected]>
AuthorDate: Thu Aug 13 09:52:21 2026 +0200
PROTON-2956 Delivery tag at pool index 256 is not unique
(cherry picked from commit 159bad569405482cf0d80395400f533a1f5f647c)
---
.../protonj2/engine/impl/ProtonPooledTagGenerator.java | 2 +-
.../engine/impl/ProtonPooledTagGeneratorTest.java | 15 +++++++++++++++
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git
a/protonj2/src/main/java/org/apache/qpid/protonj2/engine/impl/ProtonPooledTagGenerator.java
b/protonj2/src/main/java/org/apache/qpid/protonj2/engine/impl/ProtonPooledTagGenerator.java
index 69e0e66a..f2c245ec 100644
---
a/protonj2/src/main/java/org/apache/qpid/protonj2/engine/impl/ProtonPooledTagGenerator.java
+++
b/protonj2/src/main/java/org/apache/qpid/protonj2/engine/impl/ProtonPooledTagGenerator.java
@@ -79,7 +79,7 @@ public class ProtonPooledTagGenerator extends
ProtonSequentialTagGenerator {
if (nextTagId >= 0 && nextTagId < tagPoolSize) {
// Pooled tag that will return to pool on next release.
- nextTag = new ProtonPooledDeliveryTag((byte)
nextTagId++).checkOut();
+ nextTag = new ProtonPooledDeliveryTag(nextTagId++).checkOut();
} else {
// Non-pooled tag that will not return to the pool on next release.
nextTag = super.nextTag();
diff --git
a/protonj2/src/test/java/org/apache/qpid/protonj2/engine/impl/ProtonPooledTagGeneratorTest.java
b/protonj2/src/test/java/org/apache/qpid/protonj2/engine/impl/ProtonPooledTagGeneratorTest.java
index b152bf70..23be0ebd 100644
---
a/protonj2/src/test/java/org/apache/qpid/protonj2/engine/impl/ProtonPooledTagGeneratorTest.java
+++
b/protonj2/src/test/java/org/apache/qpid/protonj2/engine/impl/ProtonPooledTagGeneratorTest.java
@@ -25,8 +25,11 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;
import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Set;
import org.apache.qpid.protonj2.engine.DeliveryTagGenerator;
+import org.apache.qpid.protonj2.types.Binary;
import org.apache.qpid.protonj2.types.DeliveryTag;
import org.junit.jupiter.api.Test;
@@ -79,6 +82,18 @@ public class ProtonPooledTagGeneratorTest {
assertFalse(tags.contains(nonCached));
}
+ @Test
+ public void testAllPooledTagsAreUniqueUntilReleased() {
+ ProtonPooledTagGenerator generator = new ProtonPooledTagGenerator();
+ final Set<Binary> tagValues = new
HashSet<>(ProtonPooledTagGenerator.DEFAULT_MAX_NUM_POOLED_TAGS);
+
+ for (int i = 0; i <
ProtonPooledTagGenerator.DEFAULT_MAX_NUM_POOLED_TAGS; ++i) {
+ final DeliveryTag tag = generator.nextTag();
+
+ assertTrue(tagValues.add(new Binary(tag.tagBytes())), "Delivery
tag at pool index " + i + " is not unique");
+ }
+ }
+
@Test
public void testConsumeAllPooledTagsAndThenReleaseAfterCreatingNonPooled()
{
ProtonPooledTagGenerator generator = new ProtonPooledTagGenerator();
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]