diff options
author | Tschaen, Brendan <ctschaen@att.com> | 2019-03-14 17:03:27 -0400 |
---|---|---|
committer | Tschaen, Brendan <ctschaen@att.com> | 2019-03-14 17:03:27 -0400 |
commit | 4bc956de441cff664657a77a609081ce154e1759 (patch) | |
tree | 09bf1031de519f97d8ca634227717738181e36c7 /mdbc-server/src | |
parent | f61985dedb975a777bed88fb17c482d0dbb73cd8 (diff) |
Shutdown hook logic
Release connections and partitions owned by this server instance
Change-Id: I293705b0d212fcba7e6f80678dee70130a8abe25
Issue-ID: MUSIC-361
Signed-off-by: Tschaen, Brendan <ctschaen@att.com>
Diffstat (limited to 'mdbc-server/src')
-rwxr-xr-x | mdbc-server/src/main/java/org/onap/music/mdbc/MdbcServer.java | 1 | ||||
-rw-r--r-- | mdbc-server/src/main/java/org/onap/music/mdbc/StateManager.java | 9 |
2 files changed, 10 insertions, 0 deletions
diff --git a/mdbc-server/src/main/java/org/onap/music/mdbc/MdbcServer.java b/mdbc-server/src/main/java/org/onap/music/mdbc/MdbcServer.java index 08f6e1e..1712c30 100755 --- a/mdbc-server/src/main/java/org/onap/music/mdbc/MdbcServer.java +++ b/mdbc-server/src/main/java/org/onap/music/mdbc/MdbcServer.java @@ -103,6 +103,7 @@ public class MdbcServer { public void stop() { if (null != server) { + meta.getStateManager().releaseAllPartitions(); server.stop(); server = null; } 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 8e7976f..430e783 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 @@ -344,4 +344,13 @@ public class StateManager { public OwnershipAndCheckpoint getOwnAndCheck() { return ownAndCheck; } + + /** + * Close all connections for this server, relinquishing any locks/partitions owned by this server + */ + public void releaseAllPartitions() { + for(String connection: this.connectionRanges.keySet()) { + closeConnection(connection); + } + } } |