Skip to content

Commit

Permalink
re-introduce ByteBufferPool.offer() instead of offerFirst() (#6379)
Browse files Browse the repository at this point in the history
Signed-off-by: Ludovic Orban <lorban@bitronix.be>
  • Loading branch information
lorban committed Jan 9, 2024
1 parent 78dc11b commit 278ad3f
Showing 1 changed file with 4 additions and 4 deletions.
Expand Up @@ -15,9 +15,9 @@

import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Deque;
import java.util.List;
import java.util.concurrent.ConcurrentLinkedDeque;
import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
import java.util.function.Consumer;
Expand Down Expand Up @@ -149,7 +149,7 @@ public void release(ByteBuffer buffer)

public static class Bucket
{
private final Deque<ByteBuffer> _queue = new ConcurrentLinkedDeque<>();
private final Queue<ByteBuffer> _queue = new ConcurrentLinkedQueue<>();
private final int _capacity;
private final int _maxSize;
private final AtomicInteger _size;
Expand Down Expand Up @@ -209,7 +209,7 @@ void clear(Consumer<ByteBuffer> memoryFn)

private void queueOffer(ByteBuffer buffer)
{
_queue.offerFirst(buffer);
_queue.offer(buffer);
}

private ByteBuffer queuePoll()
Expand Down

0 comments on commit 278ad3f

Please sign in to comment.