You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ta...@apache.org on 2026/10/06 18:20:27 UTC
(qpid-protonj2) branch main updated: PROTON-2956 Delivery tag at pool index 256 is not unique
This is an automated email from the ASF dual-hosted git repository.
tabish121 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/qpid-protonj2.git
The following commit(s) were added to refs/heads/main by this push:
new 159bad56 PROTON-2956 Delivery tag at pool index 256 is not unique
159bad56 is described below
commit 159bad569405482cf0d80395400f533a1f5f647c
Author: Daniil Kirilyuk <da...@gmail.com>
AuthorDate: Thu Aug 13 09:52:21 2026 +0200
PROTON-2956 Delivery tag at pool index 256 is not unique
---
.../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: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org