dianfu commented on code in PR #27145:
URL: https://github.com/apache/flink/pull/27145#discussion_r2464440218


##########
flink-python/pyflink/fn_execution/datastream/process/async_function/operation.py:
##########
@@ -0,0 +1,276 @@
+################################################################################
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+# limitations under the License.
+################################################################################
+import asyncio
+import pickle
+import threading
+from typing import TypeVar, Generic, List, Iterable
+
+from pyflink.datastream import RuntimeContext, ResultFuture
+from pyflink.datastream.functions import AsyncFunctionDescriptor
+from pyflink.fn_execution.datastream.process.async_function.queue import \
+    UnorderedStreamElementQueue, StreamElementQueue
+from pyflink.fn_execution.datastream.process.operations import Operation
+from pyflink.fn_execution.datastream.process.runtime_context import 
StreamingRuntimeContext
+
+OUT = TypeVar('OUT')
+
+
+class AtomicBoolean(object):
+    def __init__(self, initial_value=False):
+        self._value = initial_value
+        self._lock = threading.Lock()
+
+    def get(self):
+        with self._lock:
+            return self._value
+
+    def set(self, new_value):
+        with self._lock:
+            self._value = new_value
+
+    def get_and_set(self, new_value):
+        with self._lock:
+            old_value = self._value
+            self._value = new_value
+            return old_value
+
+    def compare_and_set(self, expected, new_value):
+        with self._lock:
+            if self._value == expected:
+                self._value = new_value
+                return True
+            return False
+
+
+class ResultHandler(ResultFuture, Generic[OUT]):

Review Comment:
   Yes, you are right. It's planned to be supported in a separate ticket 
https://issues.apache.org/jira/browse/FLINK-38561



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to