davidzollo commented on code in PR #10609:
URL: https://github.com/apache/seatunnel/pull/10609#discussion_r2980688897
##########
seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/JdbcOutputFormat.java:
##########
@@ -72,6 +78,44 @@ public void open() throws IOException {
e);
}
jdbcStatementExecutor =
createAndOpenStatementExecutor(statementExecutorFactory);
+ scheduledFuture = createAndStartScheduledFlush();
+ }
+
+ private ScheduledFuture<?> createAndStartScheduledFlush() {
+ long batchIntervalMs = jdbcConnectionConfig.getBatchIntervalMs();
+ if (batchIntervalMs <= 0 || jdbcConnectionConfig.getBatchSize() == 1) {
+ LOG.info(
+ "Periodic flush disabled: batch_interval_ms={},
batch_size={}",
+ batchIntervalMs,
+ jdbcConnectionConfig.getBatchSize());
+ return null;
+ }
+
+ executor =
+ Executors.newScheduledThreadPool(
+ 1,
+ runnable -> {
+ Thread thread = new Thread(runnable);
+ thread.setDaemon(true);
+ thread.setName("jdbc-batch-flush-scheduler");
Review Comment:
There may be multiple such jdbc synchronization tasks on one Worker, and the
thread names need to be distinguished.
--
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]