aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Nelson <nelson24@att.com>2019-04-15 18:08:11 +0000
committerGerrit Code Review <gerrit@onap.org>2019-04-15 18:08:11 +0000
commit1ec38875f207407ad8f4dc5b428e5ca47f016d5f (patch)
tree25f858e34bbc2a9fb54d13727544acfdd8f0d51d
parentf4152e22bbf9bcde4996ad7a153ace4af99c5f0c (diff)
parent3d19f1656446b9095750de7a87aaca08e95cdeda (diff)
Merge "Close connection also updates StateManager"
-rwxr-xr-xmdbc-server/src/main/java/org/onap/music/mdbc/MdbcConnection.java3
-rw-r--r--mdbc-server/src/main/java/org/onap/music/mdbc/StateManager.java2
2 files changed, 4 insertions, 1 deletions
diff --git a/mdbc-server/src/main/java/org/onap/music/mdbc/MdbcConnection.java b/mdbc-server/src/main/java/org/onap/music/mdbc/MdbcConnection.java
index 72b8899..02b5415 100755
--- a/mdbc-server/src/main/java/org/onap/music/mdbc/MdbcConnection.java
+++ b/mdbc-server/src/main/java/org/onap/music/mdbc/MdbcConnection.java
@@ -272,6 +272,9 @@ public class MdbcConnection implements Connection {
} catch (MDBCServiceException e) {
throw new SQLException("Failure during relinquish of partition",e);
}
+ // Warning! Make sure this call remains AFTER the call to jdbcConn.close(),
+ // otherwise you're going to get stuck in an infinite loop.
+ statemanager.closeConnection(id);
}
@Override
diff --git a/mdbc-server/src/main/java/org/onap/music/mdbc/StateManager.java b/mdbc-server/src/main/java/org/onap/music/mdbc/StateManager.java
index 1105bda..e4c4a24 100644
--- a/mdbc-server/src/main/java/org/onap/music/mdbc/StateManager.java
+++ b/mdbc-server/src/main/java/org/onap/music/mdbc/StateManager.java
@@ -283,7 +283,7 @@ public class StateManager {
transactionInfo.deleteTxProgress(connectionId);
try {
Connection conn = mdbcConnections.get(connectionId);
- if(conn!=null) {
+ if (conn!=null && !conn.isClosed()) {
conn.close();
}
} catch (SQLException e) {