Fixed performance bug
This commit is contained in:
parent
03d2b0cdf9
commit
6cf162bb91
|
@ -594,7 +594,7 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
if (result){
|
if (result){
|
||||||
_log.info("Wrote user post with id " + post.getKey());
|
_log.info("Wrote user post with id " + post.getKey());
|
||||||
}
|
}
|
||||||
closeSession(session);
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -642,7 +642,7 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
if (result){
|
if (result){
|
||||||
_log.info("Wrote user post with id " + post.getKey());
|
_log.info("Wrote user post with id " + post.getKey());
|
||||||
}
|
}
|
||||||
closeSession(session);
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -732,7 +732,7 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
boolean result = session.execute(writeBatch).wasApplied();
|
boolean result = session.execute(writeBatch).wasApplied();
|
||||||
if (result)
|
if (result)
|
||||||
_log.info("Wrote app post with id " + post.getKey());
|
_log.info("Wrote app post with id " + post.getKey());
|
||||||
closeSession(session);
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -780,7 +780,7 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
boolean result = session.execute(writeBatch).wasApplied();
|
boolean result = session.execute(writeBatch).wasApplied();
|
||||||
if (result)
|
if (result)
|
||||||
_log.info("Wrote app post with id " + post.getKey());
|
_log.info("Wrote app post with id " + post.getKey());
|
||||||
closeSession(session);
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -842,10 +842,10 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
|
|
||||||
PreparedStatement stmt3 = createVreTimelineEntry(session);
|
PreparedStatement stmt3 = createVreTimelineEntry(session);
|
||||||
writeBatch.add(stmt3.bind(vreid, toCheck.getTime().toInstant(), UUID.fromString(toCheck.getKey())));
|
writeBatch.add(stmt3.bind(vreid, toCheck.getTime().toInstant(), UUID.fromString(toCheck.getKey())));
|
||||||
closeSession(session);
|
|
||||||
try{
|
try{
|
||||||
boolean res = session.execute(writeBatch).wasApplied();
|
boolean res = session.execute(writeBatch).wasApplied();
|
||||||
closeSession(session);
|
|
||||||
return res;
|
return res;
|
||||||
}catch (Exception e) {
|
}catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -871,10 +871,10 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
|
|
||||||
PreparedStatement stmt3 = createVreTimelineEntry(session);
|
PreparedStatement stmt3 = createVreTimelineEntry(session);
|
||||||
writeBatch.add(stmt3.bind(vreid, toCheck.getTime().toInstant(), UUID.fromString(toCheck.getKey())));
|
writeBatch.add(stmt3.bind(vreid, toCheck.getTime().toInstant(), UUID.fromString(toCheck.getKey())));
|
||||||
closeSession(session);
|
|
||||||
try{
|
try{
|
||||||
boolean res = session.execute(writeBatch).wasApplied();
|
boolean res = session.execute(writeBatch).wasApplied();
|
||||||
closeSession(session);
|
|
||||||
return res;
|
return res;
|
||||||
}catch (Exception e) {
|
}catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -893,10 +893,10 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
Feed post;
|
Feed post;
|
||||||
try{
|
try{
|
||||||
post = findFeedById(feedid, session).get();
|
post = findFeedById(feedid, session).get();
|
||||||
closeSession(session);
|
|
||||||
} catch (Exception e){
|
} catch (Exception e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
closeSession(session);
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return post;
|
return post;
|
||||||
|
@ -912,10 +912,10 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
Post post;
|
Post post;
|
||||||
try{
|
try{
|
||||||
post = findPostById(postid, session).get();
|
post = findPostById(postid, session).get();
|
||||||
closeSession(session);
|
|
||||||
} catch (Exception e){
|
} catch (Exception e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
closeSession(session);
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return post;
|
return post;
|
||||||
|
@ -939,7 +939,7 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
.isEqualTo(QueryBuilder.bindMarker())
|
.isEqualTo(QueryBuilder.bindMarker())
|
||||||
.build());
|
.build());
|
||||||
result = session.execute(stmtFind.bind(userid));
|
result = session.execute(stmtFind.bind(userid));
|
||||||
closeSession(session);
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -986,7 +986,7 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
.isEqualTo(QueryBuilder.bindMarker())
|
.isEqualTo(QueryBuilder.bindMarker())
|
||||||
.build());
|
.build());
|
||||||
result = session.execute(stmtFind.bind(userid));
|
result = session.execute(stmtFind.bind(userid));
|
||||||
closeSession(session);
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -1030,10 +1030,10 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
session.execute(writeBatch);
|
session.execute(writeBatch);
|
||||||
closeSession(session);
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
_log.error("Delete Post ERROR for postid " + feedId);
|
_log.error("Delete Post ERROR for postid " + feedId);
|
||||||
closeSession(session);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
_log.info("Delete Post OK");
|
_log.info("Delete Post OK");
|
||||||
|
@ -1053,10 +1053,10 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
session.execute(writeBatch);
|
session.execute(writeBatch);
|
||||||
closeSession(session);
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
_log.error("Delete Post ERROR for postid " + postid);
|
_log.error("Delete Post ERROR for postid " + postid);
|
||||||
closeSession(session);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
_log.info("Delete Post OK");
|
_log.info("Delete Post OK");
|
||||||
|
@ -1221,10 +1221,10 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
.build());
|
.build());
|
||||||
try {
|
try {
|
||||||
result = session.execute(stmtFind.bind(userid));
|
result = session.execute(stmtFind.bind(userid));
|
||||||
closeSession(session);
|
|
||||||
} catch (Exception e){
|
} catch (Exception e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
closeSession(session);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
List<String> toReturn = result.all().stream().map(row-> {
|
List<String> toReturn = result.all().stream().map(row-> {
|
||||||
|
@ -1253,10 +1253,10 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
.build());
|
.build());
|
||||||
try {
|
try {
|
||||||
result = session.execute(stmtFind.bind(userid));
|
result = session.execute(stmtFind.bind(userid));
|
||||||
closeSession(session);
|
|
||||||
} catch (Exception e){
|
} catch (Exception e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
closeSession(session);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
List<String> toReturn = result.all().stream().map(row-> {
|
List<String> toReturn = result.all().stream().map(row-> {
|
||||||
|
@ -1289,10 +1289,10 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
result = session.execute(stmtFind.bind(userid));
|
result = session.execute(stmtFind.bind(userid));
|
||||||
closeSession(session);
|
|
||||||
} catch (Exception e){
|
} catch (Exception e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
closeSession(session);
|
|
||||||
}
|
}
|
||||||
for (Row row: result.all()){
|
for (Row row: result.all()){
|
||||||
if (row.getUuid(POST_ID).toString().equals(postid)){
|
if (row.getUuid(POST_ID).toString().equals(postid)){
|
||||||
|
@ -1320,10 +1320,10 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
.build());
|
.build());
|
||||||
try {
|
try {
|
||||||
result = session.execute(stmtFind.bind(appid));
|
result = session.execute(stmtFind.bind(appid));
|
||||||
closeSession(session);
|
|
||||||
} catch (Exception e){
|
} catch (Exception e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
closeSession(session);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
List<String> toReturn = result.all().stream().map(row-> {
|
List<String> toReturn = result.all().stream().map(row-> {
|
||||||
|
@ -1352,10 +1352,10 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
.build());
|
.build());
|
||||||
try {
|
try {
|
||||||
result = session.execute(stmtFind.bind(appid));
|
result = session.execute(stmtFind.bind(appid));
|
||||||
closeSession(session);
|
|
||||||
} catch (Exception e){
|
} catch (Exception e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
closeSession(session);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
List<String> toReturn = result.all().stream().map(row-> {
|
List<String> toReturn = result.all().stream().map(row-> {
|
||||||
|
@ -1387,10 +1387,10 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
.build());
|
.build());
|
||||||
try {
|
try {
|
||||||
result = session.execute(stmtFind.bind(PrivacyLevel.PORTAL.toString()));
|
result = session.execute(stmtFind.bind(PrivacyLevel.PORTAL.toString()));
|
||||||
closeSession(session);
|
|
||||||
} catch (Exception e){
|
} catch (Exception e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
closeSession(session);
|
|
||||||
}
|
}
|
||||||
for (Row row: result.all()) {
|
for (Row row: result.all()) {
|
||||||
Feed toAdd = readFeedFromRow(row);
|
Feed toAdd = readFeedFromRow(row);
|
||||||
|
@ -1412,10 +1412,10 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
.build());
|
.build());
|
||||||
try {
|
try {
|
||||||
result = session.execute(stmtFind.bind(PrivacyLevel.PORTAL.toString()));
|
result = session.execute(stmtFind.bind(PrivacyLevel.PORTAL.toString()));
|
||||||
closeSession(session);
|
|
||||||
} catch (Exception e){
|
} catch (Exception e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
closeSession(session);
|
|
||||||
}
|
}
|
||||||
for (Row row: result.all()) {
|
for (Row row: result.all()) {
|
||||||
Post toAdd = readPostFromRow(row);
|
Post toAdd = readPostFromRow(row);
|
||||||
|
@ -1637,10 +1637,10 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
.build());
|
.build());
|
||||||
try {
|
try {
|
||||||
result = session.execute(stmtFind.bind(vreid));
|
result = session.execute(stmtFind.bind(vreid));
|
||||||
closeSession(session);
|
|
||||||
} catch (Exception e){
|
} catch (Exception e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
closeSession(session);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
List<String> toReturn = result.all().stream().map(row-> {
|
List<String> toReturn = result.all().stream().map(row-> {
|
||||||
|
@ -1669,10 +1669,10 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
.build());
|
.build());
|
||||||
try {
|
try {
|
||||||
result = session.execute(stmtFind.bind(vreid));
|
result = session.execute(stmtFind.bind(vreid));
|
||||||
closeSession(session);
|
|
||||||
} catch (Exception e){
|
} catch (Exception e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
closeSession(session);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
List<String> toReturn = result.all().stream().map(row-> {
|
List<String> toReturn = result.all().stream().map(row-> {
|
||||||
|
@ -1723,7 +1723,7 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
writeBatch.add(stmt3.bind(n.getUserid(), n.getTime().toInstant(), UUID.fromString(n.getKey())));
|
writeBatch.add(stmt3.bind(n.getUserid(), n.getTime().toInstant(), UUID.fromString(n.getKey())));
|
||||||
try{
|
try{
|
||||||
boolean res = session.execute(writeBatch).wasApplied();
|
boolean res = session.execute(writeBatch).wasApplied();
|
||||||
closeSession(session);
|
|
||||||
return res;
|
return res;
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -1740,11 +1740,11 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
CqlSession session = conn.getKeyspaceSession();
|
CqlSession session = conn.getKeyspaceSession();
|
||||||
try {
|
try {
|
||||||
toReturn = findNotById(notificationid, session).get();
|
toReturn = findNotById(notificationid, session).get();
|
||||||
closeSession(session);
|
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
closeSession(session);
|
|
||||||
}
|
}
|
||||||
return toReturn;
|
return toReturn;
|
||||||
}
|
}
|
||||||
|
@ -1769,7 +1769,7 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
// execute the operations
|
// execute the operations
|
||||||
try {
|
try {
|
||||||
boolean res = session.execute(writeBatch).wasApplied();
|
boolean res = session.execute(writeBatch).wasApplied();
|
||||||
closeSession(session);
|
|
||||||
return res;
|
return res;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
_log.error("ERROR while setting Notification " + notificationidToSet + " to read.");
|
_log.error("ERROR while setting Notification " + notificationidToSet + " to read.");
|
||||||
|
@ -1791,10 +1791,10 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
.build());
|
.build());
|
||||||
try {
|
try {
|
||||||
result = session.execute(stmtFind.bind(userid));
|
result = session.execute(stmtFind.bind(userid));
|
||||||
closeSession(session);
|
|
||||||
} catch (Exception e){
|
} catch (Exception e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
closeSession(session);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrayList<String> toReturn = new ArrayList<String>();
|
ArrayList<String> toReturn = new ArrayList<String>();
|
||||||
|
@ -1820,10 +1820,10 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
.build());
|
.build());
|
||||||
try {
|
try {
|
||||||
result = session.execute(stmtFind.bind(userid));
|
result = session.execute(stmtFind.bind(userid));
|
||||||
closeSession(session);
|
|
||||||
} catch (Exception e){
|
} catch (Exception e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
closeSession(session);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrayList<String> toReturn = new ArrayList<String>();
|
ArrayList<String> toReturn = new ArrayList<String>();
|
||||||
|
@ -2020,10 +2020,10 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
boolean res = false;
|
boolean res = false;
|
||||||
try{
|
try{
|
||||||
res = session.execute(writeBatch).wasApplied();
|
res = session.execute(writeBatch).wasApplied();
|
||||||
closeSession(session);
|
|
||||||
} catch (Exception e){
|
} catch (Exception e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
closeSession(session);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (res) {
|
if (res) {
|
||||||
|
@ -2081,10 +2081,10 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
.build());
|
.build());
|
||||||
try {
|
try {
|
||||||
result = session.execute(stmtFind.bind(userid));
|
result = session.execute(stmtFind.bind(userid));
|
||||||
closeSession(session);
|
|
||||||
} catch (Exception e){
|
} catch (Exception e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
closeSession(session);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//if there are no settings for this user create an entry and put all of them at true
|
//if there are no settings for this user create an entry and put all of them at true
|
||||||
|
@ -2166,7 +2166,7 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
session.execute(writeBatch);
|
session.execute(writeBatch);
|
||||||
closeSession(session);
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return false;
|
return false;
|
||||||
|
@ -2190,15 +2190,13 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
.build());
|
.build());
|
||||||
try {
|
try {
|
||||||
result = session.execute(stmtFind.bind(UUID.fromString(commentId)));
|
result = session.execute(stmtFind.bind(UUID.fromString(commentId)));
|
||||||
closeSession(session);
|
|
||||||
if (result.all().isEmpty()) {
|
if (result.all().isEmpty()) {
|
||||||
throw new CommentIDNotFoundException("The requested commentId: " + commentId + " is not existing");
|
throw new CommentIDNotFoundException("The requested commentId: " + commentId + " is not existing");
|
||||||
}
|
}
|
||||||
toReturn = readCommentFromRow(result.one());
|
toReturn = readCommentFromRow(result.one());
|
||||||
} catch (Exception e){
|
} catch (Exception e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
closeSession(session);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return toReturn;
|
return toReturn;
|
||||||
|
@ -2220,20 +2218,22 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
List<Comment> toReturn = new ArrayList<Comment>();
|
List<Comment> toReturn = new ArrayList<Comment>();
|
||||||
ResultSet result = null;
|
ResultSet result = null;
|
||||||
CqlSession session = conn.getKeyspaceSession();
|
CqlSession session = conn.getKeyspaceSession();
|
||||||
PreparedStatement stmtFind = session.prepare(QueryBuilder
|
PreparedStatement stmtFind = session.prepare("SELECT * FROM comments WHERE postid=?");
|
||||||
|
/*PreparedStatement stmtFind = session.prepare(QueryBuilder
|
||||||
.selectFrom(COMMENTS).all()
|
.selectFrom(COMMENTS).all()
|
||||||
|
.where
|
||||||
.whereColumn(POST_ID).isEqualTo(QueryBuilder.bindMarker())
|
.whereColumn(POST_ID).isEqualTo(QueryBuilder.bindMarker())
|
||||||
.build());
|
.build());*/
|
||||||
try {
|
try {
|
||||||
result = session.execute(stmtFind.bind(UUID.fromString(postid)));
|
result = session.execute(stmtFind.bind(UUID.fromString(postid)));
|
||||||
closeSession(session);
|
|
||||||
for (Row row : result.all()) {
|
for (Row row : result.all()) {
|
||||||
Comment toAdd = readCommentFromRow(row);
|
Comment toAdd = readCommentFromRow(row);
|
||||||
toReturn.add(toAdd);
|
toReturn.add(toAdd);
|
||||||
}
|
}
|
||||||
} catch (Exception e){
|
} catch (Exception e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
closeSession(session);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return toReturn;
|
return toReturn;
|
||||||
|
@ -2283,7 +2283,7 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
.build());
|
.build());
|
||||||
try {
|
try {
|
||||||
result = session.execute(stmtFind.bind());
|
result = session.execute(stmtFind.bind());
|
||||||
closeSession(session);
|
|
||||||
|
|
||||||
if (!result.all().isEmpty()){
|
if (!result.all().isEmpty()){
|
||||||
result.all().parallelStream().forEach( row->{
|
result.all().parallelStream().forEach( row->{
|
||||||
|
@ -2303,7 +2303,7 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
}
|
}
|
||||||
} catch (Exception e){
|
} catch (Exception e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
closeSession(session);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(sort)
|
if(sort)
|
||||||
|
@ -2325,11 +2325,11 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
boolean res = session.execute(writeBatch).wasApplied();
|
boolean res = session.execute(writeBatch).wasApplied();
|
||||||
closeSession(session);
|
|
||||||
_log.info("Comments update OK to: " + comment2Edit.getText());
|
_log.info("Comments update OK to: " + comment2Edit.getText());
|
||||||
return res;
|
return res;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
closeSession(session);
|
|
||||||
_log.error("Comments update NOT OK ");
|
_log.error("Comments update NOT OK ");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -2350,9 +2350,9 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
session.execute(writeBatch);
|
session.execute(writeBatch);
|
||||||
closeSession(session);
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
closeSession(session);
|
|
||||||
_log.error("Comment Delete FAILED for " + commentid + " from Feed " + feedid);
|
_log.error("Comment Delete FAILED for " + commentid + " from Feed " + feedid);
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -2403,7 +2403,7 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
UUID.fromString(like.getFeedid())));
|
UUID.fromString(like.getFeedid())));
|
||||||
try {
|
try {
|
||||||
session.execute(writeBatch);
|
session.execute(writeBatch);
|
||||||
closeSession(session);
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return false;
|
return false;
|
||||||
|
@ -2426,9 +2426,9 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
.add(deleteUserLikeEntry(session).bind(userid, UUID.fromString(likeid)));
|
.add(deleteUserLikeEntry(session).bind(userid, UUID.fromString(likeid)));
|
||||||
try {
|
try {
|
||||||
session.execute(writeBatch);
|
session.execute(writeBatch);
|
||||||
closeSession(session);
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
closeSession(session);
|
|
||||||
_log.error("Like Delete FAILED for " + likeid + " from Feed " + feedid);
|
_log.error("Like Delete FAILED for " + likeid + " from Feed " + feedid);
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -2459,10 +2459,10 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
.build());
|
.build());
|
||||||
try {
|
try {
|
||||||
result = session.execute(stmtFind.bind(userid));
|
result = session.execute(stmtFind.bind(userid));
|
||||||
closeSession(session);
|
|
||||||
} catch (Exception e){
|
} catch (Exception e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
closeSession(session);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrayList<String> toReturn = new ArrayList<String>();
|
ArrayList<String> toReturn = new ArrayList<String>();
|
||||||
|
@ -2652,10 +2652,10 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
Like toAdd = readLikeFromRow(row);
|
Like toAdd = readLikeFromRow(row);
|
||||||
toReturn.add(toAdd);
|
toReturn.add(toAdd);
|
||||||
}
|
}
|
||||||
closeSession(session);
|
|
||||||
} catch (Exception e){
|
} catch (Exception e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
closeSession(session);
|
|
||||||
}
|
}
|
||||||
return toReturn;
|
return toReturn;
|
||||||
}
|
}
|
||||||
|
@ -2681,11 +2681,11 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
boolean secondInsert = updateVREHashtagCount(vreid, lowerCaseHashtag, true);
|
boolean secondInsert = updateVREHashtagCount(vreid, lowerCaseHashtag, true);
|
||||||
if (! (firstInsert && secondInsert)) {
|
if (! (firstInsert && secondInsert)) {
|
||||||
_log.error("saveHashTags: Could not save the hashtag(s)");
|
_log.error("saveHashTags: Could not save the hashtag(s)");
|
||||||
closeSession(session);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
closeSession(session);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -2705,12 +2705,12 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
boolean secondInsert = updateVREHashtagCount(vreid, lowerCaseHashtag, false);
|
boolean secondInsert = updateVREHashtagCount(vreid, lowerCaseHashtag, false);
|
||||||
if (! (firstDelete && secondInsert)) {
|
if (! (firstDelete && secondInsert)) {
|
||||||
_log.error("deleteHashTags: Could not delete the hashtag(s)");
|
_log.error("deleteHashTags: Could not delete the hashtag(s)");
|
||||||
closeSession(session);
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
closeSession(session);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -2732,11 +2732,11 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
secondInsert = updateVREHashtagCount(vreid, lowerCaseHashtag, true);
|
secondInsert = updateVREHashtagCount(vreid, lowerCaseHashtag, true);
|
||||||
if (! (firstInsert && secondInsert)) {
|
if (! (firstInsert && secondInsert)) {
|
||||||
_log.error("saveHashTags: Could not save the hashtag(s)");
|
_log.error("saveHashTags: Could not save the hashtag(s)");
|
||||||
closeSession(session);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
closeSession(session);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -2757,16 +2757,16 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
boolean secondInsert = updateVREHashtagCount(vreid, lowerCaseHashtag, false);
|
boolean secondInsert = updateVREHashtagCount(vreid, lowerCaseHashtag, false);
|
||||||
if (!(firstDelete && secondInsert)) {
|
if (!(firstDelete && secondInsert)) {
|
||||||
_log.error("deleteHashTags: Could not delete the hashtag(s)");
|
_log.error("deleteHashTags: Could not delete the hashtag(s)");
|
||||||
closeSession(session);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
_log.error("deleteHashTags: Could not delete the hashtag(s)");
|
_log.error("deleteHashTags: Could not delete the hashtag(s)");
|
||||||
closeSession(session);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
closeSession(session);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -2784,10 +2784,10 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
.build());
|
.build());
|
||||||
try {
|
try {
|
||||||
result = session.execute(stmtFind.bind(vreid));
|
result = session.execute(stmtFind.bind(vreid));
|
||||||
closeSession(session);
|
|
||||||
} catch (Exception e){
|
} catch (Exception e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
closeSession(session);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2816,10 +2816,10 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
.build());
|
.build());
|
||||||
try {
|
try {
|
||||||
result = session.execute(stmtFind.bind(vreid));
|
result = session.execute(stmtFind.bind(vreid));
|
||||||
closeSession(session);
|
|
||||||
} catch (Exception e){
|
} catch (Exception e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
closeSession(session);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HashMap<String, Integer> toReturn = new HashMap<String, Integer> ();
|
HashMap<String, Integer> toReturn = new HashMap<String, Integer> ();
|
||||||
|
@ -2876,7 +2876,7 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
resultPost = session.execute(stmtFind1.bind(hashtag));
|
resultPost = session.execute(stmtFind1.bind(hashtag));
|
||||||
} catch (Exception e){
|
} catch (Exception e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
closeSession(session);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PreparedStatement stmtFind2 = session.prepare(QueryBuilder
|
PreparedStatement stmtFind2 = session.prepare(QueryBuilder
|
||||||
|
@ -2889,7 +2889,7 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
resultComment = session.execute(stmtFind2.bind(hashtag));
|
resultComment = session.execute(stmtFind2.bind(hashtag));
|
||||||
} catch (Exception e){
|
} catch (Exception e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
closeSession(session);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Set<String> postIds = new HashSet<>();
|
Set<String> postIds = new HashSet<>();
|
||||||
|
@ -2930,7 +2930,7 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
resultPost = session.execute(stmtFind1.bind(hashtag));
|
resultPost = session.execute(stmtFind1.bind(hashtag));
|
||||||
} catch (Exception e){
|
} catch (Exception e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
closeSession(session);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PreparedStatement stmtFind2 = session.prepare(QueryBuilder
|
PreparedStatement stmtFind2 = session.prepare(QueryBuilder
|
||||||
|
@ -2943,7 +2943,7 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
resultComment = session.execute(stmtFind2.bind(hashtag));
|
resultComment = session.execute(stmtFind2.bind(hashtag));
|
||||||
} catch (Exception e){
|
} catch (Exception e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
closeSession(session);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Set<String> postIds = new HashSet<>();
|
Set<String> postIds = new HashSet<>();
|
||||||
|
@ -3013,7 +3013,7 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
result = session.execute(stmtFind1.bind(email));
|
result = session.execute(stmtFind1.bind(email));
|
||||||
} catch (Exception e){
|
} catch (Exception e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
closeSession(session);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Iterate rows and their columns
|
// Iterate rows and their columns
|
||||||
|
@ -3047,7 +3047,7 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
//an entry in the EMAIL Invites
|
//an entry in the EMAIL Invites
|
||||||
m.add(createNewEmailInviteEntry(session).bind(email, invite.getVreid(), UUID.fromString(invite.getKey())));
|
m.add(createNewEmailInviteEntry(session).bind(email, invite.getVreid(), UUID.fromString(invite.getKey())));
|
||||||
boolean result = session.execute(m).wasApplied();
|
boolean result = session.execute(m).wasApplied();
|
||||||
closeSession(session);
|
|
||||||
return result ? InviteOperationResult.SUCCESS : InviteOperationResult.FAILED;
|
return result ? InviteOperationResult.SUCCESS : InviteOperationResult.FAILED;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -3069,10 +3069,10 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
throw new InviteStatusNotFoundException("The requested inviteid: " + inviteid + " is not existing");
|
throw new InviteStatusNotFoundException("The requested inviteid: " + inviteid + " is not existing");
|
||||||
}
|
}
|
||||||
toReturn = readAInviteFromRow(result.one());
|
toReturn = readAInviteFromRow(result.one());
|
||||||
closeSession(session);
|
|
||||||
} catch (Exception e){
|
} catch (Exception e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
closeSession(session);
|
|
||||||
}
|
}
|
||||||
return toReturn;
|
return toReturn;
|
||||||
}
|
}
|
||||||
|
@ -3109,10 +3109,10 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
.add(updateVreInviteEntry(session, STATUS).bind(status.toString(), vreid, UUID.fromString(inviteid)));
|
.add(updateVreInviteEntry(session, STATUS).bind(status.toString(), vreid, UUID.fromString(inviteid)));
|
||||||
try {
|
try {
|
||||||
session.execute(writeBatch);
|
session.execute(writeBatch);
|
||||||
closeSession(session);
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
_log.error("ERROR while setting Invite " + inviteid + " to " + status.toString());
|
_log.error("ERROR while setting Invite " + inviteid + " to " + status.toString());
|
||||||
closeSession(session);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
_log.trace("Invite Status Set to " + status.toString() + " OK");
|
_log.trace("Invite Status Set to " + status.toString() + " OK");
|
||||||
|
@ -3132,10 +3132,10 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
.build());
|
.build());
|
||||||
try {
|
try {
|
||||||
result = session.execute(stmtFind.bind(vreid));
|
result = session.execute(stmtFind.bind(vreid));
|
||||||
closeSession(session);
|
|
||||||
} catch (Exception e){
|
} catch (Exception e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
closeSession(session);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrayList<String> invitesIds = new ArrayList<String>();
|
ArrayList<String> invitesIds = new ArrayList<String>();
|
||||||
|
@ -3183,10 +3183,10 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
Attachment toAdd = readAttachmentFromRow(row);
|
Attachment toAdd = readAttachmentFromRow(row);
|
||||||
toReturn.add(toAdd);
|
toReturn.add(toAdd);
|
||||||
}
|
}
|
||||||
closeSession(session);
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
closeSession(session);
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return toReturn;
|
return toReturn;
|
||||||
|
@ -3222,9 +3222,9 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
toSave.getThumbnailURL(),
|
toSave.getThumbnailURL(),
|
||||||
toSave.getMimeType()
|
toSave.getMimeType()
|
||||||
));
|
));
|
||||||
closeSession(session);
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
closeSession(session);
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -3517,10 +3517,10 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
//an entry in the feed CF
|
//an entry in the feed CF
|
||||||
try {
|
try {
|
||||||
session.execute(updatePostEntry(session, COMMENTS_NO).bind((long) newCount, UUID.fromString(toUpdate.getKey())));
|
session.execute(updatePostEntry(session, COMMENTS_NO).bind((long) newCount, UUID.fromString(toUpdate.getKey())));
|
||||||
closeSession(session);
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
_log.error("CommentsNo update NOT OK ");
|
_log.error("CommentsNo update NOT OK ");
|
||||||
closeSession(session);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
_log.info("CommentsNo update OK to: " + newCount);
|
_log.info("CommentsNo update OK to: " + newCount);
|
||||||
|
@ -3546,10 +3546,10 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
//an entry in the feed CF
|
//an entry in the feed CF
|
||||||
try {
|
try {
|
||||||
session.execute(updatePostEntry(session, LIKES_NO).bind((long)newCount, UUID.fromString(toUpdate.getKey())));
|
session.execute(updatePostEntry(session, LIKES_NO).bind((long)newCount, UUID.fromString(toUpdate.getKey())));
|
||||||
closeSession(session);
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
_log.error("LikesNo update NOT OK ");
|
_log.error("LikesNo update NOT OK ");
|
||||||
closeSession(session);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
_log.info("LikesNo update OK to: " + newCount);
|
_log.info("LikesNo update OK to: " + newCount);
|
||||||
|
@ -3599,10 +3599,10 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
session.execute(writeBatch);
|
session.execute(writeBatch);
|
||||||
closeSession(session);
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
_log.error("Hashtag Count update NOT OK ");
|
_log.error("Hashtag Count update NOT OK ");
|
||||||
closeSession(session);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
_log.debug("Hashtag Count update OK to: " + newCount);
|
_log.debug("Hashtag Count update OK to: " + newCount);
|
||||||
|
@ -3638,10 +3638,10 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
|
||||||
.build());
|
.build());
|
||||||
try {
|
try {
|
||||||
result = session.execute(stmtFind.getQuery());
|
result = session.execute(stmtFind.getQuery());
|
||||||
closeSession(session);
|
|
||||||
} catch (Exception e){
|
} catch (Exception e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
closeSession(session);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Row row : result.all()) {
|
for (Row row : result.all()) {
|
||||||
|
|
Loading…
Reference in New Issue