Synchronize YamlRegionFile#saveAll
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
This commit is contained in:
parent
8cbce96a2c
commit
7ba0fd3f53
|
@ -192,7 +192,7 @@ public class YamlRegionFile implements RegionDatabase {
|
|||
}
|
||||
|
||||
@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");
|
||||
|
|
Loading…
Reference in New Issue