Skip to content

Commit

Permalink
solve concurrency issue in WriteDocsToDatabase
Browse files Browse the repository at this point in the history
writeQueue.poll gives null when empty (which is possible without snychronizing the method call). This leads to a crash in writeData
  • Loading branch information
Marc Zimmermann committed Oct 11, 2021
1 parent 247bfd9 commit 0cced24
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public void doneHook() {
}
}

private void flushQueue() throws SQLException {
private synchronized void flushQueue() throws SQLException {
List<Pair<String, Map<Object, Object>>> lst = new ArrayList<>();

while (!writeQueue.isEmpty()) {
Expand Down

0 comments on commit 0cced24

Please sign in to comment.