cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jburw...@apache.org
Subject [1/2] git commit: updated refs/heads/4.8 to 8c3ca15
Date Thu, 17 Nov 2016 05:55:46 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/4.8 293ec4f3f -> 8c3ca1599


CLOUDSTACK-9460: For long running transactions, if the connection is
timed out by the mysql server then refresh it


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/a813baed
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/a813baed
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/a813baed

Branch: refs/heads/4.8
Commit: a813baed49e50c014fa22df81fc6bc8bc9095213
Parents: 9eb8b2e
Author: Abhinandan Prateek <abhinandan.prateek@shapeblue.com>
Authored: Wed Aug 17 16:15:15 2016 +0530
Committer: Abhinandan Prateek <abhinandan.prateek@shapeblue.com>
Committed: Mon Sep 19 14:08:26 2016 +0530

----------------------------------------------------------------------
 .../db/src/com/cloud/utils/db/TransactionLegacy.java    | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a813baed/framework/db/src/com/cloud/utils/db/TransactionLegacy.java
----------------------------------------------------------------------
diff --git a/framework/db/src/com/cloud/utils/db/TransactionLegacy.java b/framework/db/src/com/cloud/utils/db/TransactionLegacy.java
index af834ca..8f71e87 100644
--- a/framework/db/src/com/cloud/utils/db/TransactionLegacy.java
+++ b/framework/db/src/com/cloud/utils/db/TransactionLegacy.java
@@ -168,7 +168,7 @@ public class TransactionLegacy implements Closeable {
                 isNew = true;
             }
         }
-
+        txn.checkConnection();
         txn.takeOver(name, false);
         if (isNew) {
             s_mbean.addTransaction(txn);
@@ -176,6 +176,16 @@ public class TransactionLegacy implements Closeable {
         return txn;
     }
 
+    public void checkConnection() {
+        try {
+            if (_conn != null && !_conn.isValid(3)) {
+                _conn = null;
+            }
+        } catch (SQLException e) {
+            _conn = null;
+        }
+    }
+
     protected StackElement peekInStack(Object obj) {
         final Iterator<StackElement> it = _stack.iterator();
         while (it.hasNext()) {


Mime
View raw message