Commit a91d0568 authored by Daniel Henninger's avatar Daniel Henninger Committed by dhenninger

[JM-1298] Added auto-retry when attempting to get a new DB connection.

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/branches/openfire_3_5_0@10092 b35dd754-fafc-0310-a699-88a17e54d16e
parent b1f91238
......@@ -93,12 +93,32 @@ public class DbConnectionManager {
}
}
}
Connection con = connectionProvider.getConnection();
// TODO: May want to make these settings configurable
Integer retryCnt = 0;
Integer retryMax = 10;
Integer retryWait = 250; // milliseconds
Connection con;
do {
retryCnt++;
con = connectionProvider.getConnection();
if (con != null) {
// Got one, lets hand it off.
break;
}
try {
Thread.sleep(retryWait);
}
catch (Exception e) {
// Ignored
}
} while (retryCnt <= retryMax);
if (con == null) {
Log.error("WARNING: ConnectionManager.getConnection() " +
"failed to obtain a connection.");
}
// See if profiling is enabled. If yes, wrap the connection with a
// profiled connection.
if (profilingEnabled) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment