Skip to content

Commit

Permalink
fix: synchronizing writes to localcommand file (confluentinc#8406)
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick Stuedi committed Nov 23, 2021
1 parent 5dd4013 commit ed50b05
Showing 1 changed file with 2 additions and 2 deletions.
Expand Up @@ -59,7 +59,7 @@ public static LocalCommandsFile createWriteable(final File file) {
return new LocalCommandsFile(file, true);
}

public void write(final LocalCommand localCommand) throws IOException {
public synchronized void write(final LocalCommand localCommand) throws IOException {
if (writer == null) {
throw new IOException("Write permission denied.");
}
Expand All @@ -80,7 +80,7 @@ public List<LocalCommand> readRecords() throws IOException {
}

@Override
public void close() throws IOException {
public synchronized void close() throws IOException {
if (writer != null) {
writer.close();
}
Expand Down

0 comments on commit ed50b05

Please sign in to comment.