Merge release branch 4.8 to 4.9

* 4.8:
  CLOUDSTACK-9460: For long running transactions, if the connection is timed out by the mysql server then refresh it
This commit is contained in:
John Burwell 2016-11-17 00:54:38 -05:00
commit 22d074607c

View File

@ -168,7 +168,7 @@ public class TransactionLegacy implements Closeable {
isNew = true; isNew = true;
} }
} }
txn.checkConnection();
txn.takeOver(name, false); txn.takeOver(name, false);
if (isNew) { if (isNew) {
s_mbean.addTransaction(txn); s_mbean.addTransaction(txn);
@ -176,6 +176,16 @@ public class TransactionLegacy implements Closeable {
return txn; return txn;
} }
public void checkConnection() {
try {
if (_conn != null && !_conn.isValid(3)) {
_conn = null;
}
} catch (SQLException e) {
_conn = null;
}
}
protected StackElement peekInStack(Object obj) { protected StackElement peekInStack(Object obj) {
final Iterator<StackElement> it = _stack.iterator(); final Iterator<StackElement> it = _stack.iterator();
while (it.hasNext()) { while (it.hasNext()) {