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/09 05:40:21 UTC

[GitHub] [pulsar] lhotari commented on a diff in pull request #17559: [fix][broker] Fix potential can't remove producer/reader reference

lhotari commented on code in PR #17559:
URL: https://github.com/apache/pulsar/pull/17559#discussion_r966643646


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/systopic/TopicPoliciesSystemTopicClient.java:
##########
@@ -121,15 +121,17 @@ private String getEventKey(PulsarEvent event) {
 
         @Override
         public void close() throws IOException {
-            this.producer.close();
-            systemTopicClient.getWriters().remove(TopicPolicyWriter.this);
+            try {
+                closeAsync().get();
+            } catch (Exception e) {
+                throw new IOException(e);

Review Comment:
   this seems wrong. I'd suggest something similar as what is used in BrokerService.close: https://github.com/apache/pulsar/blob/a7f1a5657782ff7ac91a89afdd49568d74d111f5/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java#L713-L721



##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/systopic/TopicPoliciesSystemTopicClient.java:
##########
@@ -184,15 +186,17 @@ public CompletableFuture<Boolean> hasMoreEventsAsync() {
 
         @Override
         public void close() throws IOException {
-            this.reader.close();
-            systemTopic.getReaders().remove(TopicPolicyReader.this);
+            try {
+                closeAsync().get();
+            } catch (Exception e) {
+                throw new IOException(e);
+            }

Review Comment:
   this seems wrong. I'd suggest something similar as what is used in BrokerService.close: https://github.com/apache/pulsar/blob/a7f1a5657782ff7ac91a89afdd49568d74d111f5/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java#L713-L721



-- 
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