1996fanrui commented on code in PR #865: URL: https://github.com/apache/flink-kubernetes-operator/pull/865#discussion_r1717934379
########## flink-autoscaler-plugin-jdbc/src/main/java/org/apache/flink/autoscaler/jdbc/event/JdbcAutoScalerEventHandler.java: ########## @@ -38,13 +47,34 @@ * @param <Context> The job autoscaler context. */ @Experimental +@Slf4j public class JdbcAutoScalerEventHandler<KEY, Context extends JobAutoScalerContext<KEY>> implements AutoScalerEventHandler<KEY, Context> { private final JdbcEventInteractor jdbcEventInteractor; + private final Duration eventHandlerTtl; + @Nullable private final ScheduledExecutorService scheduledEventHandlerCleaner; - public JdbcAutoScalerEventHandler(JdbcEventInteractor jdbcEventInteractor) { + public JdbcAutoScalerEventHandler( + JdbcEventInteractor jdbcEventInteractor, Duration eventHandlerTtl) { this.jdbcEventInteractor = jdbcEventInteractor; + this.eventHandlerTtl = Preconditions.checkNotNull(eventHandlerTtl); + + if (eventHandlerTtl.toMillis() <= 0) { + this.scheduledEventHandlerCleaner = null; + return; + } + this.scheduledEventHandlerCleaner = + Executors.newSingleThreadScheduledExecutor( + new ThreadFactoryBuilder() + .setNameFormat("jdbc-autoscaler-events-cleaner") + .setDaemon(false) Review Comment: > There is no explicit exit operation in the entire service Jdbc event handler doesn't know who call itself, it doesn't know Autoscaler Standalone, and doesn't know k8s operator. -- 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: issues-unsubscr...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org