diff options
author | Arthur Martella <arthur.martella.1@att.com> | 2019-04-05 17:13:52 -0400 |
---|---|---|
committer | Arthur Martella <arthur.martella.1@att.com> | 2019-04-08 12:54:04 -0400 |
commit | 3d19f1656446b9095750de7a87aaca08e95cdeda (patch) | |
tree | 5e745a35a21a0077df7bbda12414598c84689701 | |
parent | 361533ff29d77c78a418967229e9fc6d72d46bd6 (diff) |
Close connection also updates StateManager
Change-Id: I5861e06a5d11e8bf58a5ae5c470cc62e1861b77f
Issue-ID: MUSIC-369
Signed-off-by: Arthur Martella <arthur.martella.1@att.com>
-rwxr-xr-x | mdbc-server/src/main/java/org/onap/music/mdbc/MdbcConnection.java | 3 | ||||
-rw-r--r-- | mdbc-server/src/main/java/org/onap/music/mdbc/StateManager.java | 2 |
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) { |