Close connection also updates StateManager 02/84402/2
authorArthur Martella <arthur.martella.1@att.com>
Fri, 5 Apr 2019 21:13:52 +0000 (17:13 -0400)
committerArthur Martella <arthur.martella.1@att.com>
Mon, 8 Apr 2019 16:54:04 +0000 (12:54 -0400)
Change-Id: I5861e06a5d11e8bf58a5ae5c470cc62e1861b77f
Issue-ID: MUSIC-369
Signed-off-by: Arthur Martella <arthur.martella.1@att.com>
mdbc-server/src/main/java/org/onap/music/mdbc/MdbcConnection.java
mdbc-server/src/main/java/org/onap/music/mdbc/StateManager.java

index 72b8899..02b5415 100755 (executable)
@@ -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
index 1105bda..e4c4a24 100644 (file)
@@ -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) {