various Updates
[music.git] / src / main / java / org / onap / music / lockingservice / MusicLockingService.java
index 2fc8a15..ae02690 100644 (file)
@@ -128,13 +128,17 @@ public class MusicLockingService implements Watcher {
         return false;
     }
 
-    public void unlockAndDeleteId(String lockIdWithDollar) {
+    public void unlockAndDeleteId(String lockIdWithDollar) throws KeeperException.NoNodeException {
         String lockId = lockIdWithDollar.replace('$', '/');
         zkLockHandle.unlock(lockId);
     }
 
-    public void deleteLock(String lockName) {
-        zkLockHandle.deleteLock(lockName);
+    public void deleteLock(String lockName) throws MusicLockingException {
+       if(lockIdExists(lockName))
+               zkLockHandle.deleteLock(lockName);
+       else{
+               throw new MusicLockingException("Lock does not exist.Please check the lock: " + lockName + " and try again");
+       }
     }
 
     public String whoseTurnIsIt(String lockName) {