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

bogong pushed a commit to branch branch-2.9
in repository https://gitbox.apache.org/repos/asf/pulsar.git

commit 69ff4dbdf7929f3ffd19cf5d8ce35eba21159020
Author: lipenghui <[email protected]>
AuthorDate: Mon Jul 4 09:32:23 2022 +0800

    [improve][broker] Use shared broker client scheduled executor provider 
(#16338)
    
    (cherry picked from commit 4dd4ba5ed6de06eb22431c74863cc9a878d8a791)
---
 .../src/main/java/org/apache/pulsar/broker/PulsarService.java       | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git 
a/pulsar-broker/src/main/java/org/apache/pulsar/broker/PulsarService.java 
b/pulsar-broker/src/main/java/org/apache/pulsar/broker/PulsarService.java
index 9c799603df8..2e4fbe6cf07 100644
--- a/pulsar-broker/src/main/java/org/apache/pulsar/broker/PulsarService.java
+++ b/pulsar-broker/src/main/java/org/apache/pulsar/broker/PulsarService.java
@@ -130,6 +130,7 @@ import 
org.apache.pulsar.client.impl.conf.ClientConfigurationData;
 import org.apache.pulsar.client.impl.conf.ConfigurationDataUtils;
 import org.apache.pulsar.client.internal.PropertiesUtils;
 import org.apache.pulsar.client.util.ExecutorProvider;
+import org.apache.pulsar.client.util.ScheduledExecutorProvider;
 import org.apache.pulsar.common.conf.InternalConfigurationData;
 import org.apache.pulsar.common.configuration.PulsarConfigurationLoader;
 import org.apache.pulsar.common.configuration.VipStatus;
@@ -237,6 +238,7 @@ public class PulsarService implements AutoCloseable, 
ShutdownService {
     protected final EventLoopGroup ioEventLoopGroup;
     private final ExecutorProvider brokerClientSharedInternalExecutorProvider;
     private final ExecutorProvider brokerClientSharedExternalExecutorProvider;
+    private final ScheduledExecutorProvider 
brokerClientSharedScheduledExecutorProvider;
     private final Timer brokerClientSharedTimer;
 
     private MetricsGenerator metricsGenerator;
@@ -340,6 +342,8 @@ public class PulsarService implements AutoCloseable, 
ShutdownService {
         // since an instance is required, a single threaded shared instance is 
used for all broker client instances
         this.brokerClientSharedExternalExecutorProvider =
                 new ExecutorProvider(1, 
"broker-client-shared-external-executor");
+        this.brokerClientSharedScheduledExecutorProvider =
+                new ScheduledExecutorProvider(1, 
"broker-client-shared-scheduled-executor");
         this.brokerClientSharedTimer =
                 new HashedWheelTimer(new 
DefaultThreadFactory("broker-client-shared-timer"), 1, TimeUnit.MILLISECONDS);
     }
@@ -536,6 +540,7 @@ public class PulsarService implements AutoCloseable, 
ShutdownService {
 
             brokerClientSharedExternalExecutorProvider.shutdownNow();
             brokerClientSharedInternalExecutorProvider.shutdownNow();
+            brokerClientSharedScheduledExecutorProvider.shutdownNow();
             brokerClientSharedTimer.stop();
             ioEventLoopGroup.shutdownGracefully();
 
@@ -1371,6 +1376,7 @@ public class PulsarService implements AutoCloseable, 
ShutdownService {
                 .timer(brokerClientSharedTimer)
                 
.internalExecutorProvider(brokerClientSharedInternalExecutorProvider)
                 
.externalExecutorProvider(brokerClientSharedExternalExecutorProvider)
+                
.scheduledExecutorProvider(brokerClientSharedScheduledExecutorProvider)
                 .build();
     }
 

Reply via email to