X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=music-core%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fmusic%2Flockingservice%2Fcassandra%2FCassaLockStore.java;h=e95333444063c5389383a7525410ce77c7eaaa52;hb=5a7bf5e9f67701d1587ab7df48ce392a5fe8d940;hp=108984760b4939af9a202afb23715f9e7061c8fc;hpb=11ee6836d6f25a1becdea60a322a72fbffd4b8b6;p=music.git diff --git a/music-core/src/main/java/org/onap/music/lockingservice/cassandra/CassaLockStore.java b/music-core/src/main/java/org/onap/music/lockingservice/cassandra/CassaLockStore.java index 10898476..e9533344 100644 --- a/music-core/src/main/java/org/onap/music/lockingservice/cassandra/CassaLockStore.java +++ b/music-core/src/main/java/org/onap/music/lockingservice/cassandra/CassaLockStore.java @@ -129,7 +129,7 @@ public class CassaLockStore { table = table_prepend_name+table; String tabQuery = "CREATE TABLE IF NOT EXISTS "+keyspace+"."+table + " ( key text, lockReference bigint, createTime text, acquireTime text, guard bigint static, " - + "lockType text, owner text, PRIMARY KEY ((key), lockReference) ) " + + "lockType text, leasePeriodTime bigint, owner text, PRIMARY KEY ((key), lockReference) ) " + "WITH CLUSTERING ORDER BY (lockReference ASC);"; PreparedQueryObject queryObject = new PreparedQueryObject(); @@ -478,9 +478,9 @@ public class CassaLockStore { queryObject.appendQueryString(" WHERE lockType = ? ALLOW FILTERING"); queryObject.addValue(LockType.WRITE); - DeadlockDetectionUtil ddu = new DeadlockDetectionUtil(); + DeadlockDetectionUtil ddu = getDeadlockDetectionUtil(); - ResultSet rs = dsHandle.executeQuorumConsistencyGet(queryObject); + ResultSet rs = dsHandle.executeLocalQuorumConsistencyGet(queryObject); logger.debug("rs has " + rs.getAvailableWithoutFetching() + (rs.isFullyFetched()?"":" (or more!)") ); Iterator it = rs.iterator(); while (it.hasNext()) { @@ -493,6 +493,14 @@ public class CassaLockStore { return deadlock; } + /** + * This is used for testing purpose + * @return new DeadlockDetectionUtil object + */ + DeadlockDetectionUtil getDeadlockDetectionUtil() { + return new DeadlockDetectionUtil(); + } + public List getAllLocksForOwner(String ownerId, String keyspace, String table) throws MusicServiceException, MusicQueryException { List toRet = new ArrayList(); String lockTable = table_prepend_name + table;