From fd306bf0a900a6ce85bf369e1fbebaa7e74f164e Mon Sep 17 00:00:00 2001 From: boy0001 Date: Sun, 14 Dec 2014 12:42:23 +1100 Subject: [PATCH] Reduced interval --- .../java/com/intellectualcrafters/plot/database/MySQL.java | 6 ++++++ .../com/intellectualcrafters/plot/database/SQLManager.java | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/MySQL.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/MySQL.java index 6c7af04e3..6338bee7f 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/MySQL.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/MySQL.java @@ -60,6 +60,12 @@ public class MySQL extends Database { this.connection = null; } + public Connection forceConnection() throws SQLException, ClassNotFoundException { + Class.forName("com.mysql.jdbc.Driver"); + this.connection = DriverManager.getConnection("jdbc:mysql://" + this.hostname + ":" + this.port + "/" + this.database, this.user, this.password); + return this.connection; + } + @Override public Connection openConnection() throws SQLException, ClassNotFoundException { if (checkConnection()) { diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java index 432616194..8630bab4e 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java @@ -86,13 +86,13 @@ public class SQLManager implements AbstractDB { Bukkit.getScheduler().scheduleSyncRepeatingTask(PlotMain.getMain(), new Runnable(){ public void run(){ try { - connection = PlotMain.getMySQL().openConnection(); + connection = PlotMain.getMySQL().forceConnection(); } catch (Exception e) { e.printStackTrace(); } } - }, 500000, 500000); + }, 11000, 11000); }