diff --git a/bindings/java/src/main/com/apple/foundationdb/DirectBufferPool.java b/bindings/java/src/main/com/apple/foundationdb/DirectBufferPool.java index 376aaea4f2..794e360b59 100644 --- a/bindings/java/src/main/com/apple/foundationdb/DirectBufferPool.java +++ b/bindings/java/src/main/com/apple/foundationdb/DirectBufferPool.java @@ -35,7 +35,7 @@ class DirectBufferPool { // is always greater than the maximum size KV allowed by FDB. // Current limits is : // 10kB for key + 100kB for value + 1 int for count + 1 int for more + 2 int for KV size - static public final int MIN_BUFFER_SIZE = (10 + 100) * 1024 + Integer.BYTES * 4; + static public final int MIN_BUFFER_SIZE = (10 + 100) * 1000 + Integer.BYTES * 4; static private final int DEFAULT_NUM_BUFFERS = 128; static private final int DEFAULT_BUFFER_SIZE = 1024 * 512; @@ -66,14 +66,14 @@ class DirectBufferPool { } /** - * Requests a {@link #DirectByteBuffer} from our pool. Returns null if pool is empty. + * Requests a {@link DirectByteBuffer} from our pool. Returns null if pool is empty. */ public synchronized ByteBuffer poll() { return buffers.poll(); } /** - * Returns the {@link #DirectByteBuffer} that was borrowed from our pool. This + * Returns the {@link DirectByteBuffer} that was borrowed from our pool. This * is non-blocking as it was borrowed from this pool. */ public synchronized void add(ByteBuffer buffer) { diff --git a/bindings/java/src/main/com/apple/foundationdb/FDB.java b/bindings/java/src/main/com/apple/foundationdb/FDB.java index 19befa8b8a..5fb4fb16d9 100644 --- a/bindings/java/src/main/com/apple/foundationdb/FDB.java +++ b/bindings/java/src/main/com/apple/foundationdb/FDB.java @@ -85,7 +85,7 @@ public class FDB { private volatile boolean netStarted = false; private volatile boolean netStopped = false; volatile boolean warnOnUnclosed = true; - protected boolean enableDirectBufferQueries = false; + private boolean enableDirectBufferQueries = false; private boolean useShutdownHook = true; private Thread shutdownHook; @@ -240,6 +240,16 @@ public class FDB { enableDirectBufferQueries = enabled; } + /** + * Determines whether getRange() queries can use {@link DirectByteBuffer} from + * {@link DirectBufferPool} to copy results. + * + * @return {@code true} if an enabled has been selected and {@code false} otherwise + */ + public boolean isDirectBufferQueriesEnabled() { + return enableDirectBufferQueries; + } + /** * Resizes the DirectBufferPool with given parameters, which is used by getRange() requests. * diff --git a/bindings/java/src/main/com/apple/foundationdb/FDBTransaction.java b/bindings/java/src/main/com/apple/foundationdb/FDBTransaction.java index 22adfbf011..7bcf39d43c 100644 --- a/bindings/java/src/main/com/apple/foundationdb/FDBTransaction.java +++ b/bindings/java/src/main/com/apple/foundationdb/FDBTransaction.java @@ -373,7 +373,7 @@ class FDBTransaction extends NativeObjectWrapper implements Transaction, OptionC Transaction_getRange(getPtr(), begin.getKey(), begin.orEqual(), begin.getOffset(), end.getKey(), end.orEqual(), end.getOffset(), rowLimit, targetBytes, streamingMode, iteration, isSnapshot, reverse), - FDB.instance().enableDirectBufferQueries, executor); + FDB.instance().isDirectBufferQueriesEnabled(), executor); } finally { pointerReadLock.unlock(); }