You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by pe...@apache.org on 2021/11/25 02:39:17 UTC

[pulsar] branch master updated: [broker] Delete TopicPoliciesService#clean, not used anymore. (#12913)

This is an automated email from the ASF dual-hosted git repository.

penghui pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git


The following commit(s) were added to refs/heads/master by this push:
     new e994511  [broker] Delete TopicPoliciesService#clean, not used anymore. (#12913)
e994511 is described below

commit e9945110e4bd6b9a4b417041dc4f203e841078f6
Author: JiangHaiting <ji...@apache.org>
AuthorDate: Thu Nov 25 10:38:21 2021 +0800

    [broker] Delete TopicPoliciesService#clean, not used anymore. (#12913)
    
    ### Motivation
    
    `TopicPoliciesService#clean` was introduced to solve listener leaking problem in #10466.
    And this is already addressed in #12904 using `unregisterListener`.
    So this method is no use any more, and I don't see any situations that we may use this again.
    
    ### Modifications
    
    Delete TopicPoliciesService#clean
---
 .../service/SystemTopicBasedTopicPoliciesService.java     | 10 ----------
 .../pulsar/broker/service/TopicPoliciesService.java       | 15 ++-------------
 2 files changed, 2 insertions(+), 23 deletions(-)

diff --git a/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/SystemTopicBasedTopicPoliciesService.java b/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/SystemTopicBasedTopicPoliciesService.java
index efd8ffc..2a35edc 100644
--- a/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/SystemTopicBasedTopicPoliciesService.java
+++ b/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/SystemTopicBasedTopicPoliciesService.java
@@ -508,16 +508,6 @@ public class SystemTopicBasedTopicPoliciesService implements TopicPoliciesServic
         });
     }
 
-    @Override
-    public void clean(TopicName topicName) {
-        TopicName realTopicName = topicName;
-        if (topicName.isPartitioned()) {
-            //change persistent://tenant/namespace/xxx-partition-0  to persistent://tenant/namespace/xxx
-            realTopicName = TopicName.get(topicName.getPartitionedTopicName());
-        }
-        listeners.remove(realTopicName);
-    }
-
     @VisibleForTesting
     protected Map<TopicName, TopicPolicies> getPoliciesCache() {
         return policiesCache;
diff --git a/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/TopicPoliciesService.java b/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/TopicPoliciesService.java
index 48d2f1e..98076c5 100644
--- a/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/TopicPoliciesService.java
+++ b/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/TopicPoliciesService.java
@@ -26,6 +26,7 @@ import org.apache.pulsar.broker.service.BrokerServiceException.TopicPoliciesCach
 import org.apache.pulsar.client.impl.Backoff;
 import org.apache.pulsar.client.impl.BackoffBuilder;
 import org.apache.pulsar.client.util.RetryUtil;
+import org.apache.pulsar.common.classification.InterfaceStability;
 import org.apache.pulsar.common.naming.NamespaceBundle;
 import org.apache.pulsar.common.naming.TopicName;
 import org.apache.pulsar.common.policies.data.TopicPolicies;
@@ -34,6 +35,7 @@ import org.apache.pulsar.common.util.FutureUtil;
 /**
  * Topic policies service.
  */
+@InterfaceStability.Evolving
 public interface TopicPoliciesService {
 
     TopicPoliciesService DISABLED = new TopicPoliciesServiceDisabled();
@@ -120,14 +122,6 @@ public interface TopicPoliciesService {
 
     void unregisterListener(TopicName topicName, TopicPolicyListener<TopicPolicies> listener);
 
-    /**
-     * clean cache and listeners in TopicPolicies and so on.
-     * @param topicName
-     */
-    default void clean(TopicName topicName) {
-        throw new UnsupportedOperationException("Clean is not supported by default");
-    }
-
     class TopicPoliciesServiceDisabled implements TopicPoliciesService {
 
         @Override
@@ -176,10 +170,5 @@ public interface TopicPoliciesService {
         public void unregisterListener(TopicName topicName, TopicPolicyListener<TopicPolicies> listener) {
             //No-op
         }
-
-        @Override
-        public void clean(TopicName topicName) {
-            //No-op
-        }
     }
 }