if (entry.getKey().equals("PRIMARY KEY")) {
primaryKey = entry.getValue(); // replaces primaryKey
primaryKey = primaryKey.trim();
- } else {
- if (counter == 0 ) fieldsString.append("" + entry.getKey() + " " + entry.getValue() + "");
+ }
+ else {
+ if (counter == 0 )
+ fieldsString.append("" + entry.getKey() + " " + entry.getValue() + "");
else fieldsString.append("," + entry.getKey() + " " + entry.getValue() + "");
}
clusterKey=clusterKey.substring(1);
}
clusterKey = clusterKey.trim();
- if (clusterKey.equals(",") ) clusterKey=""; // print error if needed ( ... ),)
+ if (clusterKey.equals(",") )
+ clusterKey=""; // print error if needed ( ... ),)
}
if (!(partitionKey.isEmpty() || clusterKey.isEmpty())
}
- if (partitionKey.isEmpty() ) primaryKey="";
- else if (clusterKey.isEmpty() ) primaryKey=" (" + partitionKey + ")";
- else primaryKey=" (" + partitionKey + ")," + clusterKey;
+ if (partitionKey.isEmpty() )
+ primaryKey="";
+ else if (clusterKey.isEmpty() )
+ primaryKey=" (" + partitionKey + ")";
+ else
+ primaryKey=" (" + partitionKey + ")," + clusterKey;
- if (primaryKey != null) fieldsString.append(", PRIMARY KEY (" + primaryKey + " )");
+ if (primaryKey != null)
+ fieldsString.append(", PRIMARY KEY (" + primaryKey + " )");
} else { // end of length > 0
Status.BAD_REQUEST.getStatusCode());
}
- if (partitionKey.isEmpty() ) primaryKey="";
- else if (clusterKey.isEmpty() ) primaryKey=" (" + partitionKey + ")";
- else primaryKey=" (" + partitionKey + ")," + clusterKey;
+ if (partitionKey.isEmpty() )
+ primaryKey="";
+ else if (clusterKey.isEmpty() )
+ primaryKey=" (" + partitionKey + ")";
+ else
+ primaryKey=" (" + partitionKey + ")," + clusterKey;
- if (primaryKey != null) fieldsString.append(", PRIMARY KEY (" + primaryKey + " )");
+ if (primaryKey != null)
+ fieldsString.append(", PRIMARY KEY (" + primaryKey + " )");
}
fieldsString.append(")");
}
public boolean checkForDeadlock(String keyspace, String table, String lockName, LockType locktype, String owner, boolean forAcquire) throws MusicServiceException, MusicQueryException {
- if (locktype.equals(LockType.READ)) return false;
- if (owner==null || owner.length()==0) return false;
+ if (locktype.equals(LockType.READ))
+ return false;
+ if (owner==null || owner.length()==0)
+ return false;
String lockTable = table_prepend_name + table;
PreparedQueryObject queryObject = new PreparedQueryObject();
ddu.setExisting(row.getString("key"), row.getString("owner"), ("0".equals(row.getString("acquiretime")))?OwnershipType.CREATED:OwnershipType.ACQUIRED);
}
boolean deadlock = ddu.checkForDeadlock(lockName, owner, forAcquire?OwnershipType.ACQUIRED:OwnershipType.CREATED);
- if (deadlock) logger.warn("Deadlock detected when " + owner + " tried to create lock on " + keyspace + "." + lockTable + "." + lockName);
+ if (deadlock)
+ logger.warn("Deadlock detected when " + owner + " tried to create lock on " + keyspace + "." + lockTable + "." + lockName);
return deadlock;
}
}
public ReturnType promoteLock(String keyspace, String table, String key, String lockRef)
- throws MusicLockingException, MusicServiceException, MusicQueryException {
+ throws MusicServiceException, MusicQueryException {
String lockqtable = table_prepend_name + table;
String selectQuery = "select * from " + keyspace + "." + lockqtable + " where key=?;";