[improve][broker] PIP-293: Delete config disableBrokerInterceptors (#20995)
diff --git a/pulsar-broker-common/src/main/java/org/apache/pulsar/broker/ServiceConfiguration.java b/pulsar-broker-common/src/main/java/org/apache/pulsar/broker/ServiceConfiguration.java
index 3d73734..25b6ac7 100644
--- a/pulsar-broker-common/src/main/java/org/apache/pulsar/broker/ServiceConfiguration.java
+++ b/pulsar-broker-common/src/main/java/org/apache/pulsar/broker/ServiceConfiguration.java
@@ -1355,12 +1355,6 @@
private Set<String> brokerInterceptors = new TreeSet<>();
@FieldContext(
- category = CATEGORY_SERVER,
- doc = "Enable or disable the broker interceptor, which is only used for testing for now"
- )
- private boolean disableBrokerInterceptors = true;
-
- @FieldContext(
category = CATEGORY_SERVER,
doc = "List of interceptors for payload processing.")
private Set<String> brokerEntryPayloadProcessors = new LinkedHashSet<>();
diff --git a/pulsar-broker/src/main/java/org/apache/pulsar/broker/web/WebService.java b/pulsar-broker/src/main/java/org/apache/pulsar/broker/web/WebService.java
index eada043..902593b 100644
--- a/pulsar-broker/src/main/java/org/apache/pulsar/broker/web/WebService.java
+++ b/pulsar-broker/src/main/java/org/apache/pulsar/broker/web/WebService.java
@@ -213,8 +213,7 @@
new RateLimitingFilter(config.getHttpRequestsMaxPerSecond())));
}
- boolean brokerInterceptorEnabled =
- pulsarService.getBrokerInterceptor() != null && !config.isDisableBrokerInterceptors();
+ boolean brokerInterceptorEnabled = pulsarService.getBrokerInterceptor() != null;
if (brokerInterceptorEnabled) {
ExceptionHandler handler = new ExceptionHandler();
// Enable PreInterceptFilter only when interceptors are enabled
diff --git a/pulsar-broker/src/test/java/org/apache/pulsar/broker/intercept/BrokerInterceptorTest.java b/pulsar-broker/src/test/java/org/apache/pulsar/broker/intercept/BrokerInterceptorTest.java
index d1cf916..405d7ca 100644
--- a/pulsar-broker/src/test/java/org/apache/pulsar/broker/intercept/BrokerInterceptorTest.java
+++ b/pulsar-broker/src/test/java/org/apache/pulsar/broker/intercept/BrokerInterceptorTest.java
@@ -69,7 +69,6 @@
public void setup() throws Exception {
conf.setSystemTopicEnabled(false);
conf.setTopicLevelPoliciesEnabled(false);
- this.conf.setDisableBrokerInterceptors(false);
this.listener1 = mock(BrokerInterceptor.class);
this.ncl1 = mock(NarClassLoader.class);
diff --git a/pulsar-broker/src/test/java/org/apache/pulsar/broker/intercept/ExceptionsBrokerInterceptorTest.java b/pulsar-broker/src/test/java/org/apache/pulsar/broker/intercept/ExceptionsBrokerInterceptorTest.java
index aa254a8..0aa80cd 100644
--- a/pulsar-broker/src/test/java/org/apache/pulsar/broker/intercept/ExceptionsBrokerInterceptorTest.java
+++ b/pulsar-broker/src/test/java/org/apache/pulsar/broker/intercept/ExceptionsBrokerInterceptorTest.java
@@ -46,7 +46,6 @@
public void setup() throws Exception {
conf.setSystemTopicEnabled(false);
conf.setTopicLevelPoliciesEnabled(false);
- this.conf.setDisableBrokerInterceptors(false);
this.enableBrokerInterceptor = true;
diff --git a/pulsar-broker/src/test/java/org/apache/pulsar/broker/testcontext/PulsarTestContext.java b/pulsar-broker/src/test/java/org/apache/pulsar/broker/testcontext/PulsarTestContext.java
index 40a4228..995dccd 100644
--- a/pulsar-broker/src/test/java/org/apache/pulsar/broker/testcontext/PulsarTestContext.java
+++ b/pulsar-broker/src/test/java/org/apache/pulsar/broker/testcontext/PulsarTestContext.java
@@ -528,9 +528,6 @@
if (configOverrideCustomizer != null) {
configOverrideCustomizer.accept(super.config);
}
- if (super.brokerInterceptor != null) {
- super.config.setDisableBrokerInterceptors(false);
- }
initializeCommonPulsarServices(spyConfig);
initializePulsarServices(spyConfig, this);
if (pulsarServiceCustomizer != null) {
diff --git a/pulsar-broker/src/test/java/org/apache/pulsar/broker/web/ProcessHandlerFilterTest.java b/pulsar-broker/src/test/java/org/apache/pulsar/broker/web/ProcessHandlerFilterTest.java
index cabde4a..6d28aeb 100644
--- a/pulsar-broker/src/test/java/org/apache/pulsar/broker/web/ProcessHandlerFilterTest.java
+++ b/pulsar-broker/src/test/java/org/apache/pulsar/broker/web/ProcessHandlerFilterTest.java
@@ -60,7 +60,6 @@
Mockito.doReturn(config).when(mockPulsarService).getConfig();
// request has MULTIPART_FORM_DATA content-type
config.setBrokerInterceptors(Sets.newHashSet("Interceptor1","Interceptor2"));
- config.setDisableBrokerInterceptors(false);
HttpServletRequest mockHttpServletRequest2 = Mockito.mock(HttpServletRequest.class);
Mockito.doReturn(MediaType.MULTIPART_FORM_DATA).when(mockHttpServletRequest2).getContentType();
ProcessHandlerFilter processHandlerFilter2 = new ProcessHandlerFilter(mockPulsarService.getBrokerInterceptor());