wuchong commented on a change in pull request #9107: [FLINK-13253][jdbc]
Deadlock may occur in JDBCUpsertOutputFormat
URL: https://github.com/apache/flink/pull/9107#discussion_r303274281
##########
File path:
flink-connectors/flink-jdbc/src/main/java/org/apache/flink/api/java/io/jdbc/JDBCUpsertOutputFormat.java
##########
@@ -116,13 +116,15 @@ public void open(int taskNumber, int numTasks) throws
IOException {
this.scheduler = Executors.newScheduledThreadPool(
1, new
ExecutorThreadFactory("jdbc-upsert-output-format"));
this.scheduledFuture =
this.scheduler.scheduleWithFixedDelay(() -> {
- if (closed) {
- return;
- }
- try {
- flush();
- } catch (Exception e) {
- flushException = e;
+ synchronized (JDBCUpsertOutputFormat.this) {
Review comment:
Why should we add `synchronized`? `flush()` is already `synchronized`,
right?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services