klion26 commented on code in PR #3457:
URL: https://github.com/apache/amoro/pull/3457#discussion_r2004932089
##########
amoro-ams/src/main/java/org/apache/amoro/server/DefaultOptimizingService.java:
##########
@@ -571,4 +532,49 @@ private Predicate<TaskRuntime<?>>
buildSuspendingPredication(Set<String> activeT
&& task.getStartTime() + taskAckTimeout <
System.currentTimeMillis();
}
}
+
+ private class OptimizingConfigWatcher implements Runnable {
+ private final ScheduledExecutorService scheduler =
+ Executors.newSingleThreadScheduledExecutor(
+ new
ThreadFactoryBuilder().setNameFormat("resource-group-watcher-%d").build());
+
+ void start() {
+ run();
+ scheduler.scheduleAtFixedRate(
+ this, refreshGroupInterval, refreshGroupInterval,
TimeUnit.MILLISECONDS);
+ }
+
+ @Override
+ public void run() {
+ syncGroups();
+ }
+
+ private void syncGroups() {
+ try {
+ List<ResourceGroup> resourceGroups =
optimizerManager.listResourceGroups();
+ Set<String> groupNames =
+
resourceGroups.stream().map(ResourceGroup::getName).collect(Collectors.toSet());
+ Sets.difference(optimizingQueueByGroup.keySet(), groupNames)
+ .forEach(DefaultOptimizingService.this::deleteResourceGroup);
Review Comment:
Do we need to handle the `tableQueue` and `retryTaskQueue` here?
the lifetime of `tableQueue` and `retryTaskQueue` is the same as
`OptimizingQueue`, if the queue has been disposed, maybe we should handle the
resource it contains(such as `tableQueue` and `retryTaskQueue`)
--
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]