Skip to content

Commit fa34d68

Browse files
committed
Merge remote-tracking branch 'apache/4.16' into 4.17
2 parents e8b249f + 77df050 commit fa34d68

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

framework/db/src/main/java/com/cloud/utils/db/ConnectionConcierge.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ public String resetConnection(String name) {
174174

175175
Connection conn = TransactionLegacy.getStandaloneConnection();
176176
if (conn == null) {
177-
return "Unable to get anotehr db connection";
177+
return "Unable to get another db connection";
178178
}
179179

180180
concierge.reset(conn);
@@ -198,9 +198,13 @@ public String resetKeepAliveTask(int seconds) {
198198
protected void runInContext() {
199199
s_logger.trace("connection concierge keep alive task");
200200
for (Map.Entry<String, ConnectionConcierge> entry : _conns.entrySet()) {
201+
String name = entry.getKey();
201202
ConnectionConcierge concierge = entry.getValue();
202203
if (concierge.keepAlive()) {
203-
testValidity(entry.getKey(), entry.getValue().conn());
204+
if (testValidity(name, concierge.conn()) != null) {
205+
s_logger.info("Resetting DB connection " + name);
206+
resetConnection(name);
207+
}
204208
}
205209
}
206210
}

0 commit comments

Comments
 (0)