Remove async option from SQLite#vacuum()

This commit is contained in:
Eric 2020-02-29 17:34:47 +01:00
parent 146f1b0dbf
commit 74db09e69e
2 changed files with 11 additions and 24 deletions

View File

@ -251,7 +251,7 @@ public class ShopChest extends JavaPlugin {
if (database != null) {
if (database instanceof SQLite) {
((SQLite) database).vacuum(false);
((SQLite) database).vacuum();
}
database.disconnect();

View File

@ -52,33 +52,20 @@ public class SQLite extends Database {
}
/**
* Vacuums the database to reduce file size
*
* @param async Whether the call should be executed asynchronously
* Vacuums the database synchronously to reduce file size
*/
public void vacuum(boolean async) {
BukkitRunnable runnable = new BukkitRunnable() {
@Override
public void run() {
public void vacuum() {
try (Connection con = dataSource.getConnection();
Statement s = con.createStatement()) {
s.executeUpdate("VACUUM");
plugin.debug("Vacuumed SQLite database");
} catch (final SQLException ex) {
plugin.getLogger().severe("Failed to vacuum database");
plugin.getLogger().warning("Failed to vacuum database");
plugin.debug("Failed to vacuum database");
plugin.debug(ex);
}
}
};
if (async) {
runnable.runTaskAsynchronously(plugin);
} else {
runnable.run();
}
}
@Override
String getQueryCreateTableShops() {