aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/main/java/org/onap/music/service/impl/MusicCassaCore.java31
1 files changed, 9 insertions, 22 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 343ba1f1..824dc0c4 100644
--- a/src/main/java/org/onap/music/service/impl/MusicCassaCore.java
+++ b/src/main/java/org/onap/music/service/impl/MusicCassaCore.java
@@ -401,12 +401,14 @@ public class MusicCassaCore implements MusicCoreService {
String primaryKeyValue = splitString[2];
try {
getLockingServiceHandle().deQueueLockRef(keyspace, table, primaryKeyValue, lockReference);
- } catch (MusicLockingException | MusicServiceException | MusicQueryException e) {
- logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(), AppMessages.DESTROYLOCK + lockReference, ErrorSeverity.CRITICAL, ErrorTypes.LOCKINGERROR);
+ } catch (MusicServiceException | MusicQueryException | MusicLockingException e) {
+ logger.error(EELFLoggerDelegate.errorLogger, e.getMessage(), AppMessages.DESTROYLOCK + " " + primaryKeyValue + " " + lockReference, ErrorSeverity.CRITICAL, ErrorTypes.LOCKINGERROR);
+ logger.info(EELFLoggerDelegate.applicationLogger, "Lock not destroyed " + primaryKeyValue + " " + lockReference + " " + " :" + e.getMessage());
+ return new MusicLockState(MusicLockState.LockStatus.LOCKED, "");
}
long end = System.currentTimeMillis();
- logger.info(EELFLoggerDelegate.applicationLogger, "Time taken to destroy lock reference:" + (end - start) + " ms");
- return getMusicLockState(fullyQualifiedKey);
+ logger.info(EELFLoggerDelegate.applicationLogger, "Time taken to destroy lock reference " + primaryKeyValue + " " + lockReference + " " + " :" + (end - start) + " ms");
+ return new MusicLockState(MusicLockState.LockStatus.UNLOCKED, "");
}
finally {
TimeMeasureInstance.instance().exit();
@@ -624,7 +626,7 @@ public class MusicCassaCore implements MusicCoreService {
try {
Thread.sleep(Integer.min(100, (int) Math.pow(2, createLockReferenceTries - 1)));
} catch (InterruptedException e) {
- e.printStackTrace();
+ logger.error(EELFLoggerDelegate.errorLogger, e.getMessage());
}
} else
break;
@@ -644,7 +646,7 @@ public class MusicCassaCore implements MusicCoreService {
try {
Thread.sleep(Integer.min(100, (int) Math.pow(2, acquireLockTries - 1)));
} catch (InterruptedException e) {
- e.printStackTrace();
+ logger.error(EELFLoggerDelegate.errorLogger, e.getMessage());
}
} else
break;
@@ -679,9 +681,6 @@ public class MusicCassaCore implements MusicCoreService {
TimeMeasureInstance.instance().exit();
}
}
-
-
-
/**
* This method performs DDL operation on cassasndra, when the lock for the resource is acquired.
@@ -713,13 +712,10 @@ public class MusicCassaCore implements MusicCoreService {
return null;
}
}
-
-
+
public static MusicLockState getMusicLockState(String fullyQualifiedKey) {
return null;
}
-
-
/**
* @param lockName
@@ -738,15 +734,6 @@ public class MusicCassaCore implements MusicCoreService {
resultMap.put("keyspace",keyspace);
return resultMap;
}
-
-
- public static void main(String[] args) {
- String x = "axe top";
- x = x.replaceFirst("top", "sword");
- System.out.print(x); //returns sword pickaxe
- }
-
-
@Override
public ReturnType atomicPutWithDeleteLock(String keyspaceName, String tableName, String primaryKey,