pnowojski commented on a change in pull request #8361: [FLINK-12434][network]
Replace listeners with CompletableFuture in InputGates
URL: https://github.com/apache/flink/pull/8361#discussion_r282403707
##########
File path:
flink-runtime/src/main/java/org/apache/flink/runtime/util/SetArrayDeque.java
##########
@@ -16,20 +16,38 @@
* limitations under the License.
*/
-package org.apache.flink.runtime.io.network.partition.consumer;
+package org.apache.flink.runtime.util;
+
+import java.util.ArrayDeque;
+import java.util.HashSet;
+import java.util.Set;
/**
- * Listener interface implemented by consumers of {@link InputGate} instances
- * that want to be notified of availability of buffer or event instances.
+ * Wrapper of {@link ArrayDeque} with quick {@link HashSet}'s based {@link
#contains(Object)} method.
*/
-public interface InputGateListener {
+public class SetArrayDeque<T> {
+ private final ArrayDeque<T> deque = new ArrayDeque<>();
+ private final Set<T> set = new HashSet<>();
+
+ public boolean add(T element) {
+ return deque.add(element) || set.add(element);
Review comment:
I've changed it in the end to `LinkedHashSet`.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services