You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@pekko.apache.org by "He-Pin (via GitHub)" <gi...@apache.org> on 2023/12/02 06:44:54 UTC

[PR] =str Fix maybe throw for `MinimalStage`. [incubator-pekko]

He-Pin opened a new pull request, #822:
URL: https://github.com/apache/incubator-pekko/pull/822

   The `MinimalStage` is also a `CompletableFuture`, but calling `isDone` on it will throw `UnsupportedOperationException`.


-- 
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: notifications-unsubscribe@pekko.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


Re: [PR] =str Fix maybe throw for `MinimalStage`. [incubator-pekko]

Posted by "He-Pin (via GitHub)" <gi...@apache.org>.
He-Pin merged PR #822:
URL: https://github.com/apache/incubator-pekko/pull/822


-- 
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: notifications-unsubscribe@pekko.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


Re: [PR] =str Fix maybe throw for `MinimalStage`. [incubator-pekko]

Posted by "mdedetrich (via GitHub)" <gi...@apache.org>.
mdedetrich commented on PR #822:
URL: https://github.com/apache/incubator-pekko/pull/822#issuecomment-1837080324

   > One this got merged, I think this should be back port to 1.0.x too.
   
   I disagree on this part as this is a behavioural change which we want to keep to a minimum in 1.0.x branch (and I wouldn't classify this as a critical bug).
   
   For 1.1.x its fine


-- 
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: notifications-unsubscribe@pekko.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


Re: [PR] =str Fix maybe throw for `MinimalStage`. [incubator-pekko]

Posted by "He-Pin (via GitHub)" <gi...@apache.org>.
He-Pin commented on PR #822:
URL: https://github.com/apache/incubator-pekko/pull/822#issuecomment-1837073707

   One this got merged, I think this should be back port to 1.0.x too.


-- 
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: notifications-unsubscribe@pekko.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


Re: [PR] =str Fix maybe throw for `MinimalStage`. [incubator-pekko]

Posted by "He-Pin (via GitHub)" <gi...@apache.org>.
He-Pin commented on code in PR #822:
URL: https://github.com/apache/incubator-pekko/pull/822#discussion_r1412744228


##########
stream-tests/src/test/java-jdk9-only/org/apache/pekko/stream/javadsl/FlowUnfoldAsyncTest.java:
##########
@@ -0,0 +1,57 @@
+/*
+ * 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.
+ */
+
+package org.apache.pekko.stream.javadsl;
+
+import org.apache.pekko.japi.Pair;
+import org.apache.pekko.stream.StreamTest;
+import org.apache.pekko.testkit.PekkoJUnitActorSystemResource;
+import org.apache.pekko.testkit.PekkoSpec;
+import org.junit.Assert;
+import org.junit.ClassRule;
+import org.junit.Test;
+
+import java.util.Optional;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.TimeUnit;
+
+public class FlowUnfoldAsyncTest extends StreamTest {
+    @ClassRule
+    public static PekkoJUnitActorSystemResource actorSystemResource =
+        new PekkoJUnitActorSystemResource("SourceTest", PekkoSpec.testConf());
+
+    public FlowUnfoldAsyncTest() {
+        super(actorSystemResource);
+    }
+
+    @Test
+    public void testFoldAsync() throws Exception {
+        final Integer result = Source.unfoldAsync(
+                0,
+                idx -> {
+                    if (idx >= 10) {
+                        return CompletableFuture.completedStage(Optional.empty());
+                    } else {
+                        return CompletableFuture.completedStage(Optional.of(Pair.create(idx + 1, idx)));

Review Comment:
   This method returns a `MinimalStage` , still not know why douglee make the MinimalStage extends CompletableFuture.



-- 
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: notifications-unsubscribe@pekko.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org