diff --git a/src/main/java/de/epiceric/shopchest/ShopChest.java b/src/main/java/de/epiceric/shopchest/ShopChest.java index 9aa1801..c5065d7 100644 --- a/src/main/java/de/epiceric/shopchest/ShopChest.java +++ b/src/main/java/de/epiceric/shopchest/ShopChest.java @@ -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(); diff --git a/src/main/java/de/epiceric/shopchest/sql/SQLite.java b/src/main/java/de/epiceric/shopchest/sql/SQLite.java index 07dd334..02b3cb4 100644 --- a/src/main/java/de/epiceric/shopchest/sql/SQLite.java +++ b/src/main/java/de/epiceric/shopchest/sql/SQLite.java @@ -52,31 +52,18 @@ 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() { - try (Connection con = dataSource.getConnection(); - Statement s = con.createStatement()) { - s.executeUpdate("VACUUM"); + 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.debug("Failed to vacuum database"); - plugin.debug(ex); - } - } - }; - - if (async) { - runnable.runTaskAsynchronously(plugin); - } else { - runnable.run(); + plugin.debug("Vacuumed SQLite database"); + } catch (final SQLException ex) { + plugin.getLogger().warning("Failed to vacuum database"); + plugin.debug("Failed to vacuum database"); + plugin.debug(ex); } }