Reliability boost for database mode.

This commit is contained in:
ryanhamshire 2015-09-20 13:36:32 -07:00
parent 442d05a4e0
commit 1ba6f7bc9d

View File

@ -613,14 +613,14 @@ public class DatabaseDataStore extends DataStore
private synchronized void refreshDataConnection() throws SQLException private synchronized void refreshDataConnection() throws SQLException
{ {
if(this.databaseConnection == null || this.databaseConnection.isClosed()) if(this.databaseConnection == null || !this.databaseConnection.isValid(3))
{ {
//set username/pass properties //set username/pass properties
Properties connectionProps = new Properties(); Properties connectionProps = new Properties();
connectionProps.put("user", this.userName); connectionProps.put("user", this.userName);
connectionProps.put("password", this.password); connectionProps.put("password", this.password);
connectionProps.put("autoReconnect", "true"); connectionProps.put("autoReconnect", "true");
connectionProps.put("maxReconnects", "4"); connectionProps.put("maxReconnects", Integer.MAX_VALUE);
//establish connection //establish connection
this.databaseConnection = DriverManager.getConnection(this.databaseUrl, connectionProps); this.databaseConnection = DriverManager.getConnection(this.databaseUrl, connectionProps);