◐ Shell
reader mode source ↗
Skip to content
Merged
Changes from all commits
File filter
Conversations
Jump to
Diff view
Apply and reload
Show whitespace
Diff view
Apply and reload
10 changes: 5 additions & 5 deletions src/main/java/org/lmdbjava/DirectBufferProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@
import static org.lmdbjava.UnsafeAccess.UNSAFE;

import java.nio.ByteBuffer;

import jnr.ffi.Pointer;
import org.agrona.DirectBuffer;
import org.agrona.MutableDirectBuffer;
import org.agrona.concurrent.OneToOneConcurrentArrayQueue;
import org.agrona.concurrent.UnsafeBuffer;

/**
@@ -55,8 +55,8 @@ public final class DirectBufferProxy extends BufferProxy<DirectBuffer> {
* of a negative length) then that buffer is used. If no valid buffer is
* found, a new buffer is created.
*/
private static final ThreadLocal<OneToOneConcurrentArrayQueue<DirectBuffer>> BUFFERS
= withInitial(() -> new OneToOneConcurrentArrayQueue<>(16));

private DirectBufferProxy() {
}
Expand Down Expand Up @@ -100,7 +100,7 @@ public static int compareBuff(final DirectBuffer o1, final DirectBuffer o2) {

@Override
protected DirectBuffer allocate() {
final OneToOneConcurrentArrayQueue<DirectBuffer> q = BUFFERS.get();
final DirectBuffer buffer = q.poll();

if (buffer != null && buffer.capacity() >= 0) {
Expand All @@ -118,7 +118,7 @@ protected int compare(final DirectBuffer o1, final DirectBuffer o2) {

@Override
protected void deallocate(final DirectBuffer buff) {
final OneToOneConcurrentArrayQueue<DirectBuffer> q = BUFFERS.get();
q.offer(buff);
}

Expand Down
Toggle all file notes Toggle all file annotations