You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2019/03/09 00:13:31 UTC

[GitHub] [pulsar] lovelle commented on a change in pull request #3786: [pulsar-function] fix deadlock in pulsar-source

lovelle commented on a change in pull request #3786: [pulsar-function] fix deadlock in pulsar-source
URL: https://github.com/apache/pulsar/pull/3786#discussion_r263971124
 
 

 ##########
 File path: pulsar-functions/instance/src/main/java/org/apache/pulsar/functions/source/PulsarSource.java
 ##########
 @@ -100,7 +98,15 @@ public void open(Map<String, Object> config, SourceContext sourceContext) throws
             }
 
             return cb.subscribeAsync();
-        }).collect(Collectors.toList()).stream().map(CompletableFuture::join).collect(Collectors.toList());
+        }).collect(Collectors.toList()).stream().map(consumerFuture -> {
+            try {
+                return consumerFuture.get(consumerOpTimeoutMs, TimeUnit.MILLISECONDS);
 
 Review comment:
   wouldn't be possible to use `CompletableFuture.allOf(listConsumersFuture).get(timeout)` so we could check for `InterruptedException` outside `map()` and throw some pulsar checked exception instead of an unchecked exception ?
   I think is better to avoid side effects on lambdas expressions.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services