framework/db: add checkConnection method

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
Rohit Yadav 2016-07-20 17:05:41 +05:30
parent 3c30e97d2d
commit d89d1eec6d
1 changed files with 10 additions and 0 deletions

View File

@ -177,6 +177,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()) {