From cb73819252b66269c4f97a176655be7e69e8e5bd Mon Sep 17 00:00:00 2001 From: Brianna Date: Wed, 9 Dec 2020 11:09:31 -0600 Subject: [PATCH] Revert "Added PreparedStatement queuing. " This reverts commit 66c43f06d7f98f93249c762cc86436e2838402cc. --- .../core/database/DataManagerAbstract.java | 25 ------------------- 1 file changed, 25 deletions(-) diff --git a/Core/src/main/java/com/songoda/core/database/DataManagerAbstract.java b/Core/src/main/java/com/songoda/core/database/DataManagerAbstract.java index 47c4febe..540b68a6 100644 --- a/Core/src/main/java/com/songoda/core/database/DataManagerAbstract.java +++ b/Core/src/main/java/com/songoda/core/database/DataManagerAbstract.java @@ -4,7 +4,6 @@ import org.bukkit.Bukkit; import org.bukkit.plugin.Plugin; import java.sql.Connection; -import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; @@ -20,7 +19,6 @@ public class DataManagerAbstract { protected final Plugin plugin; private static Map> queues = new HashMap<>(); - private static Map> queuedStatements = new HashMap<>(); public DataManagerAbstract(DatabaseConnector databaseConnector, Plugin plugin) { this.databaseConnector = databaseConnector; @@ -80,29 +78,6 @@ public class DataManagerAbstract { Bukkit.getScheduler().runTask(this.plugin, runnable); } - /** - * Queue PreparedStatements to be executed in a single database connection. - * - * @param statement statement to queue. - * @param queueKey the queue key to add the statement to. - * @param delay the delay between each queue execution. - */ - public void queueAsync(PreparedStatement statement, String queueKey, long delay) { - if (queues.get(queueKey) == null || queues.get(queueKey).isEmpty()) - Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, () -> { - databaseConnector.connect(connection -> { - List queue = queuedStatements.get(queueKey); - for (PreparedStatement stmt : queue) - stmt.executeBatch(); - connection.commit(); - queue.clear(); - }); - }, delay); - - List queue = queuedStatements.computeIfAbsent(queueKey, t -> new LinkedList<>()); - queue.add(statement); - } - /** * Queue tasks to be ran asynchronously. *