import org.onap.music.datastore.PreparedQueryObject;
import org.onap.music.datastore.jsonobjects.JsonKeySpace;
import org.onap.music.eelf.logging.EELFLoggerDelegate;
import org.onap.music.datastore.PreparedQueryObject;
import org.onap.music.datastore.jsonobjects.JsonKeySpace;
import org.onap.music.eelf.logging.EELFLoggerDelegate;
import org.onap.music.exceptions.MusicLockingException;
import org.onap.music.exceptions.MusicQueryException;
import org.onap.music.exceptions.MusicServiceException;
import org.onap.music.exceptions.MusicLockingException;
import org.onap.music.exceptions.MusicQueryException;
import org.onap.music.exceptions.MusicServiceException;
*/
if (acquireLock(key, lockId).getResult() == ResultType.SUCCESS) {
mls = getMusicLockState(key);// get latest state
*/
if (acquireLock(key, lockId).getResult() == ResultType.SUCCESS) {
mls = getMusicLockState(key);// get latest state
if (mls.getLeaseStartTime() == -1) {// set it again only if it is not set already
mls.setLeaseStartTime(System.currentTimeMillis());
mls.setLeasePeriod(leasePeriod);
if (mls.getLeaseStartTime() == -1) {// set it again only if it is not set already
mls.setLeaseStartTime(System.currentTimeMillis());
mls.setLeasePeriod(leasePeriod);
} catch (MusicLockingException e2) {
logger.error(EELFLoggerDelegate.errorLogger,"Failed to aquireLock lockId " + lockId + " " + e2);
}
} catch (MusicLockingException e2) {
logger.error(EELFLoggerDelegate.errorLogger,"Failed to aquireLock lockId " + lockId + " " + e2);
}
logger.info(EELFLoggerDelegate.applicationLogger,"In acquire lock: Not your turn, someone else has the lock");
try {
if (!getLockingServiceHandle().lockIdExists(lockId)) {
logger.info(EELFLoggerDelegate.applicationLogger,"In acquire lock: Not your turn, someone else has the lock");
try {
if (!getLockingServiceHandle().lockIdExists(lockId)) {
logger.info(EELFLoggerDelegate.applicationLogger,"In acquire lock: A table or keyspace lock so no need to perform sync...so returning true");
return new ReturnType(ResultType.SUCCESS, "A table or keyspace lock so no need to perform sync...so returning true");
}
logger.info(EELFLoggerDelegate.applicationLogger,"In acquire lock: A table or keyspace lock so no need to perform sync...so returning true");
return new ReturnType(ResultType.SUCCESS, "A table or keyspace lock so no need to perform sync...so returning true");
}
selectQuery.appendQueryString("SELECT * FROM " + keyspaceName + "." + tableName + " WHERE "
+ primaryKeyName + "= ?" + ";");
selectQuery.addValue(cqlFormattedPrimaryKeyValue);
selectQuery.appendQueryString("SELECT * FROM " + keyspaceName + "." + tableName + " WHERE "
+ primaryKeyName + "= ?" + ";");
selectQuery.addValue(cqlFormattedPrimaryKeyValue);
StringBuilder fieldValueString = new StringBuilder("");
for (Definition definition : colInfo) {
String colName = definition.getName();
StringBuilder fieldValueString = new StringBuilder("");
for (Definition definition : colInfo) {
String colName = definition.getName();
DataType colType = definition.getType();
Object valueObj = getDSHandle().getColValue(row, colName, colType);
Object valueString = MusicUtil.convertToActualDataType(colType, valueObj);
DataType colType = definition.getType();
Object valueObj = getDSHandle().getColValue(row, colName, colType);
Object valueString = MusicUtil.convertToActualDataType(colType, valueObj);
fieldValueString.append(colName + " = ?");
updateQuery.addValue(valueString);
if (counter != (totalColumns - 1))
fieldValueString.append(colName + " = ?");
updateQuery.addValue(valueString);
if (counter != (totalColumns - 1))
updateQuery.appendQueryString("UPDATE " + keyspaceName + "." + tableName + " SET "
+ fieldValueString + " WHERE " + primaryKeyName + "= ? " + ";");
updateQuery.addValue(cqlFormattedPrimaryKeyValue);
updateQuery.appendQueryString("UPDATE " + keyspaceName + "." + tableName + " SET "
+ fieldValueString + " WHERE " + primaryKeyName + "= ? " + ";");
updateQuery.addValue(cqlFormattedPrimaryKeyValue);
getDSHandle().executePut(updateQuery, "critical");
} catch (MusicServiceException | MusicQueryException e) {
getDSHandle().executePut(updateQuery, "critical");
} catch (MusicServiceException | MusicQueryException e) {