Skip to content

Commit e76c3ee

Browse files
committed
#12790 add reproducer
Signed-off-by: Ludovic Orban <[email protected]>
1 parent 44c2971 commit e76c3ee

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

jetty-core/jetty-io/src/test/java/org/eclipse/jetty/io/ArrayByteBufferPoolTest.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,30 @@
4141

4242
public class ArrayByteBufferPoolTest
4343
{
44+
@Test
45+
public void testRemoveAndReleaseCompoundPool()
46+
{
47+
int bufferCount = ConcurrentPool.OPTIMAL_MAX_SIZE * 2;
48+
List<RetainableByteBuffer> rbbs = new ArrayList<>();
49+
50+
ArrayByteBufferPool pool = new ArrayByteBufferPool();
51+
for (int i = 0; i < bufferCount; i++)
52+
{
53+
RetainableByteBuffer rbb = pool.acquire(1, false);
54+
rbbs.add(rbb);
55+
}
56+
rbbs.forEach(Retainable::release);
57+
rbbs.clear();
58+
59+
for (int i = 0; i < bufferCount; i++)
60+
{
61+
RetainableByteBuffer rbb = pool.acquire(1, false);
62+
rbbs.add(rbb);
63+
}
64+
65+
rbbs.forEach(pool::removeAndRelease);
66+
}
67+
4468
@Test
4569
public void testDump()
4670
{

0 commit comments

Comments
 (0)