You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "philipnee (via GitHub)" <gi...@apache.org> on 2023/04/04 16:44:39 UTC

[GitHub] [kafka] philipnee commented on a diff in pull request #13490: KAFKA-14875: Implement wakeup

philipnee commented on code in PR #13490:
URL: https://github.com/apache/kafka/pull/13490#discussion_r1157514521


##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/PrototypeAsyncConsumer.java:
##########
@@ -546,6 +543,26 @@ public ConsumerRecords<K, V> poll(long timeout) {
         throw new KafkaException("method not implemented");
     }
 
+    <T> T tryGetFutureResult(
+            final Time time,
+            final WakeupableFuture<T> future,
+            final Duration timeout) throws ExecutionException, InterruptedException {
+        Timer timer = time.timer(timeout.toMillis());
+        do {
+            if (future.isDone()) {
+                return future.get();
+            }
+
+            if (this.shouldWakeup.get()) {
+                this.shouldWakeup.set(false);
+                future.cancel(true);

Review Comment:
   you are right!



-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org