Jason918 commented on code in PR #16408:
URL: https://github.com/apache/pulsar/pull/16408#discussion_r924288593
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/LoadSheddingTask.java:
##########
@@ -39,6 +49,13 @@ public void run() {
loadManager.get().doLoadShedding();
} catch (Exception e) {
LOG.warn("Error during the load shedding", e);
+ } finally {
+ if (!loadManagerExecutor.isShutdown()) {
+ loadManagerExecutor.schedule(
+ new LoadSheddingTask(loadManager, loadManagerExecutor,
config),
Review Comment:
Can we use `this` here?
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/PulsarService.java:
##########
@@ -1032,9 +1030,10 @@ protected void startLeaderElectionService() {
if (loadResourceQuotaTask != null) {
loadResourceQuotaTask.cancel(false);
}
- loadSheddingTask =
loadManagerExecutor.scheduleAtFixedRate(
- new LoadSheddingTask(loadManager),
- loadSheddingInterval,
loadSheddingInterval, TimeUnit.MILLISECONDS);
+ loadSheddingTask = loadManagerExecutor.schedule(
Review Comment:
Previous `loadSheddingTask.cancel()` is called when this broker became
follower from leader. `loadManagerExecutor` is only shutdown when broker stops.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]