diff --git a/src/main/java/io/lettuce/core/AutoBatchFlushOptions.java b/src/main/java/io/lettuce/core/AutoBatchFlushOptions.java new file mode 100644 index 0000000000..1166f4c4d1 --- /dev/null +++ b/src/main/java/io/lettuce/core/AutoBatchFlushOptions.java @@ -0,0 +1,160 @@ +package io.lettuce.core; + +import java.io.Serializable; + +import io.lettuce.core.internal.LettuceAssert; + +/** + * Options for command timeouts. These options configure how and whether commands time out once they were dispatched. Command + * timeout begins: + *
+ * Should only be called from the single consumer thread. + * + * @param q a queue to add + */ + void offerFirstAll(@Nullable Deque extends E> q); + + /** + * poll the first element from the head of the queue. + *
+ * Should only be called from the single consumer thread.
+ *
+ * @return null if the queue is empty else the first element of the queue
+ */
+ @Nullable
+ E poll();
+
+ boolean isEmpty();
+
+}
diff --git a/src/main/java/io/lettuce/core/datastructure/queue/offerfirst/impl/ConcurrentLinkedOfferFirstQueue.java b/src/main/java/io/lettuce/core/datastructure/queue/offerfirst/impl/ConcurrentLinkedOfferFirstQueue.java
new file mode 100644
index 0000000000..f97a4668bf
--- /dev/null
+++ b/src/main/java/io/lettuce/core/datastructure/queue/offerfirst/impl/ConcurrentLinkedOfferFirstQueue.java
@@ -0,0 +1,50 @@
+package io.lettuce.core.datastructure.queue.offerfirst.impl;
+
+import java.util.Deque;
+import java.util.concurrent.ConcurrentLinkedDeque;
+
+import javax.annotation.Nullable;
+
+import io.lettuce.core.datastructure.queue.offerfirst.UnboundedOfferFirstQueue;
+
+/**
+ * @author chenxiaofan
+ */
+public class ConcurrentLinkedOfferFirstQueue