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 2022/09/12 13:23:04 UTC
[GitHub] [pulsar] HQebupt commented on a diff in pull request #17559: [fix][broker] Fix potential can't remove producer/reader reference
HQebupt commented on code in PR #17559:
URL: https://github.com/apache/pulsar/pull/17559#discussion_r968413682
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/systopic/TopicPoliciesSystemTopicClient.java:
##########
@@ -184,15 +194,23 @@ public CompletableFuture<Boolean> hasMoreEventsAsync() {
@Override
public void close() throws IOException {
- this.reader.close();
- systemTopic.getReaders().remove(TopicPolicyReader.this);
+ try {
+ closeAsync().get();
+ } catch (ExecutionException e) {
+ if (e.getCause() instanceof IOException) {
+ throw (IOException) e.getCause();
+ } else {
+ throw new PulsarServerException(e.getCause());
+ }
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ }
}
@Override
public CompletableFuture<Void> closeAsync() {
- return reader.closeAsync().thenCompose(v -> {
Review Comment:
This line is key point. The previous `thenCompose` is replaced by `thenApply` just to save `CompletableFuture`. 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: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org