Skip to content

Commit

Permalink
Attempt to catch communicationsexceptions.
Browse files Browse the repository at this point in the history
  • Loading branch information
N3X15 committed Jun 8, 2011
1 parent ce0c55a commit 2cab075
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/main/java/me/taylorkelly/bigbrother/datasource/BBDB.java
Expand Up @@ -16,6 +16,8 @@
import java.util.HashMap;
import java.util.Map;

import com.mysql.jdbc.CommunicationsException;

import me.taylorkelly.bigbrother.BBLogging;
import me.taylorkelly.bigbrother.BBSettings;
import me.taylorkelly.bigbrother.BBSettings.DBMS;
Expand Down Expand Up @@ -345,6 +347,13 @@ public static ResultSet executeQuery(String sql, Object... params) {
return null;
rs = stmt.getResultSet();
statements.put(rs,new StatementInfo(stmt));
} catch(CommunicationsException e) {
BBLogging.severe("Communications failure, attempting to reconnect.",e);
try {
reconnect();
} catch (SQLException e1) {
BBLogging.severe("Failed to reconnect.",e1);
}
} catch (SQLException e) {
BBLogging.severe("executeQuery failed (" + sql + "):", e);
} finally {
Expand Down

0 comments on commit 2cab075

Please sign in to comment.