Reduced interval

This commit is contained in:
boy0001 2014-12-14 12:42:23 +11:00
parent 7266a2a875
commit fd306bf0a9
2 changed files with 8 additions and 2 deletions

View File

@ -60,6 +60,12 @@ public class MySQL extends Database {
this.connection = null; 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 @Override
public Connection openConnection() throws SQLException, ClassNotFoundException { public Connection openConnection() throws SQLException, ClassNotFoundException {
if (checkConnection()) { if (checkConnection()) {

View File

@ -86,13 +86,13 @@ public class SQLManager implements AbstractDB {
Bukkit.getScheduler().scheduleSyncRepeatingTask(PlotMain.getMain(), new Runnable(){ Bukkit.getScheduler().scheduleSyncRepeatingTask(PlotMain.getMain(), new Runnable(){
public void run(){ public void run(){
try { try {
connection = PlotMain.getMySQL().openConnection(); connection = PlotMain.getMySQL().forceConnection();
} }
catch (Exception e) { catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
}, 500000, 500000); }, 11000, 11000);
} }