diff --git a/repository-ydb-v1/src/main/java/tech/ydb/yoj/repository/ydb/YdbSpliterator.java b/repository-ydb-v1/src/main/java/tech/ydb/yoj/repository/ydb/YdbSpliterator.java index 316c5d2c..c3272bdc 100644 --- a/repository-ydb-v1/src/main/java/tech/ydb/yoj/repository/ydb/YdbSpliterator.java +++ b/repository-ydb-v1/src/main/java/tech/ydb/yoj/repository/ydb/YdbSpliterator.java @@ -35,7 +35,11 @@ class YdbSpliterator implements Spliterator { // Deadline for stream work private final long streamWorkDeadlineNanos; private final int flags; - // ArrayBlockingQueue(1) is used instead SynchronousQueue because clear() behavior is needed + /* ArrayBlockingQueue(1) is used instead SynchronousQueue because clear() behavior is needed + * ArrayBlockingQueue(1) was chosen to minimize memory usage. This is not a performance-efficient solution + * since it requires synchronization between threads for each object. If necessary, we can increase + * the queue size or choose a different mechanism for concurrency interaction. + */ private final BlockingQueue> queue = new ArrayBlockingQueue<>(1); private final BiConsumer validateResponse; diff --git a/repository-ydb-v2/src/main/java/tech/ydb/yoj/repository/ydb/YdbSpliterator.java b/repository-ydb-v2/src/main/java/tech/ydb/yoj/repository/ydb/YdbSpliterator.java index c0ff42ca..5bb8364c 100644 --- a/repository-ydb-v2/src/main/java/tech/ydb/yoj/repository/ydb/YdbSpliterator.java +++ b/repository-ydb-v2/src/main/java/tech/ydb/yoj/repository/ydb/YdbSpliterator.java @@ -36,7 +36,11 @@ public class YdbSpliterator implements Spliterator { // Deadline for stream work private final long streamWorkDeadlineNanos; private final int flags; - // ArrayBlockingQueue(1) is used instead SynchronousQueue because clear() behavior is needed + /* ArrayBlockingQueue(1) is used instead SynchronousQueue because clear() behavior is needed + * ArrayBlockingQueue(1) was chosen to minimize memory usage. This is not a performance-efficient solution + * since it requires synchronization between threads for each object. If necessary, we can increase + * the queue size or choose a different mechanism for concurrency interaction. + */ private final BlockingQueue> queue = new ArrayBlockingQueue<>(1); private final BiConsumer validateResponse;