safe multithreading config writes

This commit is contained in:
Craig Raw 2021-01-08 16:11:36 +02:00
parent 94897e9744
commit 901a4520fd

View file

@ -277,12 +277,13 @@ public class Config {
flush();
}
private void flush() {
private synchronized void flush() {
Gson gson = getGson();
try {
File configFile = getConfigFile();
Writer writer = new FileWriter(configFile);
gson.toJson(this, writer);
writer.flush();
writer.close();
} catch (IOException e) {
//Ignore