Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionException;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.RejectedExecutionException;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
import java.util.concurrent.locks.Lock;
Expand Down Expand Up @@ -174,8 +174,8 @@ public class ModularLoadManagerImpl implements ModularLoadManager {
// Pulsar service used to initialize this.
private PulsarService pulsar;

// Executor service used to regularly update broker data.
private final ScheduledExecutorService scheduler;
// Executor service used to update broker data.
private final ExecutorService executors;

// check if given broker can load persistent/non-persistent topic
private final BrokerTopicLoadingPredicate brokerTopicLoadingPredicate;
Expand Down Expand Up @@ -215,7 +215,7 @@ public ModularLoadManagerImpl() {
loadData = new LoadData();
loadSheddingPipeline = new ArrayList<>();
preallocatedBundleToBroker = new ConcurrentHashMap<>();
scheduler = Executors.newSingleThreadScheduledExecutor(
executors = Executors.newSingleThreadExecutor(
new ExecutorProvider.ExtendedThreadFactory("pulsar-modular-load-manager"));
this.brokerToFailureDomainMap = new HashMap<>();
this.bundleBrokerAffinityMap = new ConcurrentHashMap<>();
Expand Down Expand Up @@ -276,7 +276,7 @@ public void initialize(final PulsarService pulsar) {
// register listeners for domain changes
pulsar.getPulsarResources().getClusterResources().getFailureDomainResources()
.registerListener(__ -> {
scheduler.execute(() -> refreshBrokerToFailureDomainMap());
executors.execute(() -> refreshBrokerToFailureDomainMap());
});

loadSheddingPipeline.add(createLoadSheddingStrategy());
Expand All @@ -290,7 +290,7 @@ public void handleDataNotification(Notification t) {
});

try {
scheduler.execute(ModularLoadManagerImpl.this::updateAll);
executors.execute(ModularLoadManagerImpl.this::updateAll);
} catch (RejectedExecutionException e) {
// Executor is shutting down
}
Expand Down Expand Up @@ -982,7 +982,7 @@ public void start() throws PulsarServerException {
*/
@Override
public void stop() throws PulsarServerException {
scheduler.shutdownNow();
executors.shutdownNow();

try {
brokersData.close();
Expand Down