diff options
-rw-r--r-- | src/main/java/org/onap/music/service/impl/MusicCassaCore.java | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/main/java/org/onap/music/service/impl/MusicCassaCore.java b/src/main/java/org/onap/music/service/impl/MusicCassaCore.java index 7eebf65a..e3347486 100644 --- a/src/main/java/org/onap/music/service/impl/MusicCassaCore.java +++ b/src/main/java/org/onap/music/service/impl/MusicCassaCore.java @@ -668,7 +668,23 @@ public class MusicCassaCore implements MusicCoreService { ReturnType criticalPutResult = criticalPut(keyspaceName, tableName, primaryKey, queryObject, lockReference, conditionInfo); long criticalPutTime = System.currentTimeMillis(); - voluntaryReleaseLock(fullyQualifiedKey, lockReference); + + int releaseTries = 0; + while (true) { + MusicLockState rs = voluntaryReleaseLock(fullyQualifiedKey, lockReference); + releaseTries++; + if (rs.getLockStatus() != MusicLockState.LockStatus.UNLOCKED) { + try { + Thread.sleep(Integer.min(100, (int) Math.pow(2, releaseTries - 1))); + } catch (InterruptedException e) { + } + } else + break; + } + if (releaseTries > 1) { + System.out.print((char) (Integer.min(releaseTries, 9) + 78)); + } + long lockDeleteTime = System.currentTimeMillis(); String timingInfo = "|lock creation time:" + (lockCreationTime - start) + "|lock accquire time:" + (lockAcqTime - lockCreationTime) |