private void registerOptimizer(OptimizerInstance optimizer, boolean needPersistent) {
    if (needPersistent) {
      doAs(OptimizerMapper.class, mapper -> mapper.insertOptimizer(optimizer));
    }

    OptimizingQueue optimizingQueue = optimizingQueueByGroup.get(optimizer.getGroupName());
    optimizingQueue.addOptimizer(optimizer);
    authOptimizers.put(optimizer.getToken(), optimizer);
    optimizingQueueByToken.put(optimizer.getToken(), optimizingQueue);
    optimizerKeeper.keepInTouch(optimizer);
  }
DefaultOptimizingService is implementing the OptimizerManager Thrift service, which manages the
optimizing tasks for tables. It includes methods for authenticating optimizers, polling tasks
from the optimizing queue, acknowledging tasks,and completing tasks. The code uses several data
structures, including maps for optimizing queues ,task runtimes, and authenticated optimizers.

<p>The code also includes a TimerTask for detecting and removing expired optimizers and
suspending tasks.
amoro-ams/src/main/java/org/apache/amoro/server/DefaultOptimizingService.java