Skip to content

Commit

Permalink
[AMORO-3141] When a master/backup switch occurs, close the `planExecu…
Browse files Browse the repository at this point in the history
…tor` thread pool (#3142)

(cherry picked from commit a8b2ff5)
Signed-off-by: zhoujinsong <[email protected]>
  • Loading branch information
rfyu authored and zhoujinsong committed Oct 11, 2024
1 parent a26da28 commit 5200a86
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,11 @@ public void dispose() {
terminalManager.dispose();
terminalManager = null;
}
optimizingService = null;
if (optimizingService != null) {
LOG.info("Stopping optimizing service...");
optimizingService.dispose();
optimizingService = null;
}

EventsManager.dispose();
MetricManager.dispose();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.DelayQueue;
import java.util.concurrent.Delayed;
import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import java.util.function.Predicate;
Expand Down Expand Up @@ -99,7 +99,7 @@ public class DefaultOptimizingService extends StatedPersistentBase
private final OptimizerKeeper optimizerKeeper = new OptimizerKeeper();
private final TableService tableService;
private final RuntimeHandlerChain tableHandlerChain;
private final Executor planExecutor;
private final ExecutorService planExecutor;

public DefaultOptimizingService(Configurations serviceConfig, DefaultTableService tableService) {
this.optimizerTouchTimeout = serviceConfig.getLong(AmoroManagementConf.OPTIMIZER_HB_TIMEOUT);
Expand Down Expand Up @@ -385,6 +385,7 @@ public void dispose() {
optimizingQueueByGroup.clear();
optimizingQueueByToken.clear();
authOptimizers.clear();
planExecutor.shutdown();
}

public boolean canDeleteResourceGroup(String name) {
Expand Down

0 comments on commit 5200a86

Please sign in to comment.