wsz94 commented on a change in pull request #17643:
URL: https://github.com/apache/flink/pull/17643#discussion_r742099276
##########
File path:
flink-connectors/flink-connector-pulsar/src/main/java/org/apache/flink/connector/pulsar/source/reader/split/PulsarUnorderedPartitionSplitReader.java
##########
@@ -80,8 +80,16 @@ public PulsarUnorderedPartitionSplitReader(
@Override
protected Message<byte[]> pollMessage(Duration timeout)
throws ExecutionException, InterruptedException, TimeoutException {
- Message<byte[]> message =
- pulsarConsumer.receiveAsync().get(timeout.toMillis(),
TimeUnit.MILLISECONDS);
+ CompletableFuture<Message<byte[]>> messageCompletableFuture =
pulsarConsumer.receiveAsync();
Review comment:
> I think we can use `Message<T> receive(int timeout, TimeUnit unit)`,
this would be better for this fix.
Thanks. I agree with your proposal. Using the `receive(timeout)` could avoid
this issue.
##########
File path:
flink-connectors/flink-connector-pulsar/src/main/java/org/apache/flink/connector/pulsar/source/reader/split/PulsarUnorderedPartitionSplitReader.java
##########
@@ -80,8 +80,16 @@ public PulsarUnorderedPartitionSplitReader(
@Override
protected Message<byte[]> pollMessage(Duration timeout)
throws ExecutionException, InterruptedException, TimeoutException {
- Message<byte[]> message =
- pulsarConsumer.receiveAsync().get(timeout.toMillis(),
TimeUnit.MILLISECONDS);
+ CompletableFuture<Message<byte[]>> messageCompletableFuture =
pulsarConsumer.receiveAsync();
Review comment:
> I think we can use `Message<T> receive(int timeout, TimeUnit unit)`,
this would be better for this fix.
Thanks. I agree with your proposal. Using the `receive(timeout)` could avoid
this bug.
##########
File path:
flink-connectors/flink-connector-pulsar/src/main/java/org/apache/flink/connector/pulsar/source/reader/split/PulsarUnorderedPartitionSplitReader.java
##########
@@ -80,8 +80,16 @@ public PulsarUnorderedPartitionSplitReader(
@Override
protected Message<byte[]> pollMessage(Duration timeout)
throws ExecutionException, InterruptedException, TimeoutException {
- Message<byte[]> message =
- pulsarConsumer.receiveAsync().get(timeout.toMillis(),
TimeUnit.MILLISECONDS);
+ CompletableFuture<Message<byte[]>> messageCompletableFuture =
pulsarConsumer.receiveAsync();
Review comment:
> I think we can use `Message<T> receive(int timeout, TimeUnit unit)`,
this would be better for this fix.
Thanks. I agree with your proposal. Using the `receive(timeout)` could avoid
this issue.
##########
File path:
flink-connectors/flink-connector-pulsar/src/main/java/org/apache/flink/connector/pulsar/source/reader/split/PulsarUnorderedPartitionSplitReader.java
##########
@@ -80,8 +80,16 @@ public PulsarUnorderedPartitionSplitReader(
@Override
protected Message<byte[]> pollMessage(Duration timeout)
throws ExecutionException, InterruptedException, TimeoutException {
- Message<byte[]> message =
- pulsarConsumer.receiveAsync().get(timeout.toMillis(),
TimeUnit.MILLISECONDS);
+ CompletableFuture<Message<byte[]>> messageCompletableFuture =
pulsarConsumer.receiveAsync();
Review comment:
> I think we can use `Message<T> receive(int timeout, TimeUnit unit)`,
this would be better for this fix.
Thanks. I agree with your proposal. Using the `receive(timeout)` could avoid
this bug.
--
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]