Skip to content

Commit

Permalink
Synchronize YamlRegionFile#saveAll
Browse files Browse the repository at this point in the history
This prevents multiple invocations of the method from intersecting, which could potentially cause the .tmp file to be overwritten before being renamed, thus corrupting the region storage
  • Loading branch information
TomyLobo committed Jul 19, 2023
1 parent 8cbce96 commit 7ba0fd3
Showing 1 changed file with 1 addition and 1 deletion.
Expand Up @@ -192,7 +192,7 @@ public Set<ProtectedRegion> loadAll(FlagRegistry flagRegistry) throws StorageExc
}

@Override
public void saveAll(Set<ProtectedRegion> regions) throws StorageException {
public synchronized void saveAll(Set<ProtectedRegion> regions) throws StorageException {
checkNotNull(regions);

File tempFile = new File(file.getParentFile(), file.getName() + ".tmp");
Expand Down

0 comments on commit 7ba0fd3

Please sign in to comment.