mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-27 13:15:28 +01:00
Puts the GSON serialization on main thread. (#1141)
https://github.com/BentoBoxWorld/BentoBox/issues/1128
This commit is contained in:
parent
a9a9a9adee
commit
e62240f523
@ -154,8 +154,10 @@ public class SQLDatabaseHandler<T> extends AbstractJSONDatabaseHandler<T> {
|
||||
plugin.logError("This class is not a DataObject: " + instance.getClass().getName());
|
||||
return;
|
||||
}
|
||||
// This has to be on the main thread to avoid concurrent modification errors
|
||||
String toStore = getGson().toJson(instance);
|
||||
// Async
|
||||
processQueue.add(() -> store(instance.getClass().getName(), getGson().toJson(instance), sqlConfig.getSaveObjectSQL()));
|
||||
processQueue.add(() -> store(instance.getClass().getName(), toStore, sqlConfig.getSaveObjectSQL()));
|
||||
}
|
||||
|
||||
private void store(String name, String toStore, String sb) {
|
||||
|
Loading…
Reference in New Issue
Block a user