aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBharath Balasubramanian <bharathb@research.att.com>2019-10-10 20:08:23 +0000
committerGerrit Code Review <gerrit@onap.org>2019-10-10 20:08:23 +0000
commit5300ffcc9f94bfe04b11485d9e0cdbc02db0bd22 (patch)
treebc4e5565c0340461dba6684c1af77b7e0d9f753f
parent021bf79c3a37acc0121b4b18b63f572d8ac9dd7e (diff)
parentda01a036b92feb080949cd27d6d7273719eb4123 (diff)
Merge "Include owner in createLockRef"
-rw-r--r--music-core/src/main/java/org/onap/music/exceptions/MusicDeadlockException.java8
-rw-r--r--music-core/src/main/java/org/onap/music/main/MusicCore.java4
-rw-r--r--music-core/src/main/java/org/onap/music/service/MusicCoreService.java8
-rw-r--r--music-core/src/main/java/org/onap/music/service/impl/MusicCassaCore.java3
4 files changed, 19 insertions, 4 deletions
diff --git a/music-core/src/main/java/org/onap/music/exceptions/MusicDeadlockException.java b/music-core/src/main/java/org/onap/music/exceptions/MusicDeadlockException.java
index f5478e78..7a40ed91 100644
--- a/music-core/src/main/java/org/onap/music/exceptions/MusicDeadlockException.java
+++ b/music-core/src/main/java/org/onap/music/exceptions/MusicDeadlockException.java
@@ -23,10 +23,10 @@ package org.onap.music.exceptions;
public class MusicDeadlockException extends MusicLockingException {
- public String owner = null;
- public String keyspace = null;
- public String table = null;
- public String key = null;
+ private String owner = null;
+ private String keyspace = null;
+ private String table = null;
+ private String key = null;
public MusicDeadlockException() {
super();
diff --git a/music-core/src/main/java/org/onap/music/main/MusicCore.java b/music-core/src/main/java/org/onap/music/main/MusicCore.java
index 226dfb07..30d2bc47 100644
--- a/music-core/src/main/java/org/onap/music/main/MusicCore.java
+++ b/music-core/src/main/java/org/onap/music/main/MusicCore.java
@@ -84,6 +84,10 @@ public class MusicCore {
public static String createLockReferenceAtomic(String fullyQualifiedKey) throws MusicLockingException {
return musicCore.createLockReferenceAtomic(fullyQualifiedKey);
}
+
+ public static String createLockReference(String fullyQualifiedKey, String owner) throws MusicLockingException {
+ return musicCore.createLockReference(fullyQualifiedKey, owner);
+ }
public static String createLockReferenceAtomic(String fullyQualifiedKey, LockType locktype) throws MusicLockingException {
return musicCore.createLockReferenceAtomic(fullyQualifiedKey, locktype);
diff --git a/music-core/src/main/java/org/onap/music/service/MusicCoreService.java b/music-core/src/main/java/org/onap/music/service/MusicCoreService.java
index 7629eae2..2fc88145 100644
--- a/music-core/src/main/java/org/onap/music/service/MusicCoreService.java
+++ b/music-core/src/main/java/org/onap/music/service/MusicCoreService.java
@@ -94,6 +94,13 @@ public interface MusicCoreService {
/**
* Create a lock ref in the music lock store
* @param fullyQualifiedKey the key to create a lock on
+ * @param owner the owner of the lock, for deadlock prevention
+ */
+ public String createLockReference(String fullyQualifiedKey, String owner) throws MusicLockingException;
+
+ /**
+ * Create a lock ref in the music lock store
+ * @param fullyQualifiedKey the key to create a lock on
* @param locktype the type of lock create, see {@link LockType}
*/
public String createLockReferenceAtomic(String fullyQualifiedKey, LockType locktype) throws MusicLockingException;
@@ -178,4 +185,5 @@ public interface MusicCoreService {
public ReturnType deleteFromTable(JsonDelete jsonDeleteObj,MultivaluedMap<String, String> rowParams)
throws MusicLockingException, MusicQueryException, MusicServiceException;
+
}
diff --git a/music-core/src/main/java/org/onap/music/service/impl/MusicCassaCore.java b/music-core/src/main/java/org/onap/music/service/impl/MusicCassaCore.java
index c7c7cddc..63f2d14c 100644
--- a/music-core/src/main/java/org/onap/music/service/impl/MusicCassaCore.java
+++ b/music-core/src/main/java/org/onap/music/service/impl/MusicCassaCore.java
@@ -116,6 +116,9 @@ public class MusicCassaCore implements MusicCoreService {
public String createLockReferenceAtomic(String fullyQualifiedKey) throws MusicLockingException {
return createLockReferenceAtomic(fullyQualifiedKey, LockType.WRITE);
}
+ public String createLockReference(String fullyQualifiedKey, String owner) throws MusicLockingException {
+ return createLockReference(fullyQualifiedKey, LockType.WRITE, owner);
+ }
/**
* This will be called for Atomic calls