diff options
author | Tschaen, Brendan <ctschaen@att.com> | 2019-01-28 11:29:51 -0500 |
---|---|---|
committer | Tschaen, Brendan <ctschaen@att.com> | 2019-01-28 11:30:14 -0500 |
commit | d4430c99a0d11f37ff4ba845c6b563b2f8e836e9 (patch) | |
tree | 3d399c81853bafcd72bc57f47a01d44b041cd827 /src | |
parent | d3a8e023176f1469adc6d4bcd3bc20887fddc442 (diff) |
Remove dependency on random lock
Change-Id: I9ffabe0e3da2d1fa1ed8ba40e216c2a989b07188
Issue-ID: MUSIC-278
Signed-off-by: Tschaen, Brendan <ctschaen@att.com>
Diffstat (limited to 'src')
3 files changed, 7 insertions, 6 deletions
diff --git a/src/main/java/org/onap/music/prom/main/PromDaemon.java b/src/main/java/org/onap/music/prom/main/PromDaemon.java index f39228b..cf9ab01 100644 --- a/src/main/java/org/onap/music/prom/main/PromDaemon.java +++ b/src/main/java/org/onap/music/prom/main/PromDaemon.java @@ -76,14 +76,15 @@ public class PromDaemon { MusicHandle.createIndexInTable(keyspaceName, tableName, "lockref"); Map<String,Object> values = new HashMap<String,Object>(); - values.put("id",this.id); + values.put("id","PROM_ADMIN"); // need dummy for lock values.put("isactive","false"); values.put("timeoflastupdate", "0"); - //values.put("lockref", ""); MusicHandle.insertIntoTableEventual(keyspaceName, tableName, values); - //MusicHandle.insertIntoTableEventual(keyspaceName, tableName, values); - lockName = keyspaceName+".active.lock"; + values.put("id",this.id); + MusicHandle.insertIntoTableEventual(keyspaceName, tableName, values); + + lockName = keyspaceName+".Replicas.PROM_ADMIN"; } /** diff --git a/src/main/java/org/onap/music/prom/musicinterface/MusicHandle.java b/src/main/java/org/onap/music/prom/musicinterface/MusicHandle.java index 83d148b..cc7a875 100644 --- a/src/main/java/org/onap/music/prom/musicinterface/MusicHandle.java +++ b/src/main/java/org/onap/music/prom/musicinterface/MusicHandle.java @@ -579,7 +579,7 @@ public class MusicHandle { ClientResponse response = addMusicHeaders(webResource).get(ClientResponse.class); - if (response.getStatus() != 200) { + if (response.getStatus() != 200 && response.getStatus() != 400) { logger.error(EELFLoggerDelegate.errorLogger, "Failed to acquireLock : Status Code "+response.getStatus()); throw new RuntimeException("Failed : HTTP error code : " + response.getStatus()); } diff --git a/src/test/java/org/onap/music/prom/main/PromDaemonTest.java b/src/test/java/org/onap/music/prom/main/PromDaemonTest.java index be2d798..f8199b0 100644 --- a/src/test/java/org/onap/music/prom/main/PromDaemonTest.java +++ b/src/test/java/org/onap/music/prom/main/PromDaemonTest.java @@ -80,7 +80,7 @@ public class PromDaemonTest { Whitebox.invokeMethod(promDaemon, "bootStrap"); assertEquals("prom_testing", promDaemon.keyspaceName); - assertEquals("prom_testing.active.lock", promDaemon.lockName); + assertEquals("prom_testing.Replicas.PROM_ADMIN", promDaemon.lockName); } @Test |