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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]