# HG changeset patch # User casties # Date 1476965170 -7200 # Node ID fd98c31371cba8023c86d425710745d85c09d388 # Parent 23c043a19134462706954777517f76984e6030bd better transaction logging. diff -r 23c043a19134 -r fd98c31371cb src/main/java/org/mpi/openmind/cache/WrapperService.java --- a/src/main/java/org/mpi/openmind/cache/WrapperService.java Thu Oct 20 14:04:36 2016 +0200 +++ b/src/main/java/org/mpi/openmind/cache/WrapperService.java Thu Oct 20 14:06:10 2016 +0200 @@ -35,7 +35,9 @@ private static Logger logger = Logger.getLogger(WrapperService.class); - private transient CacheService cache; + private static Logger txLog = Logger.getLogger(PersistenceService.TRANSACTION_LOGGER); + + private transient CacheService cache; public long getSourceRelationsCount(Entity entity, String relationName, String tarObjClass) { @@ -599,10 +601,15 @@ entity.resetId(); entity.setType(Node.TYPE_ABOX); entity.setUser(user); - + + txLog.debug("** START save entity as new: user="+user+" entity="+entity.toSmallString()); + // save in database this.getPS().saveEntity(entity); + // save in cache cache.saveEntity(entity); - logger.info("[U=" + user + "] SaveEntityAsNew - execution time[ms]: " + (System.currentTimeMillis() - start)); + txLog.debug("** END save entity as new: user="+user+" entity="+entity.toSmallString()); + + logger.debug("[U=" + user + "] SaveEntityAsNew - execution time[ms]: " + (System.currentTimeMillis() - start)); return (Entity) entity.clone(); } @@ -626,10 +633,15 @@ entity = removeWrongRelations(entity); entity = removeEmptyAttributes(entity); + txLog.debug("** START save entity: user="+user+" entity="+entity.toSmallString()); + // save in database this.getPS().saveEntity(entity); + // save in cache cache.saveEntity(entity); + txLog.debug("** END save entity: user="+user+" entity="+entity.toSmallString()); + System.gc(); - logger.info("[U=" + user + "] SaveEntity - execution time[ms]: " + (System.currentTimeMillis() - start)); + logger.debug("[U=" + user + "] SaveEntity - execution time[ms]: " + (System.currentTimeMillis() - start)); Entity clone = (Entity) entity.clone(); // logger.info(clone.toString()); return clone; @@ -646,11 +658,13 @@ entity = removeWrongRelations(entity); entity = removeEmptyAttributes(entity); } + txLog.debug("** START save entity list: user="+user+" list="+list); this.getPS().saveEntityList(list); for(Entity entity : list){ cache.saveEntity(entity); } - logger.info("[U=" + user + "] SaveEntityList - execution time[ms]: " + (System.currentTimeMillis() - start)); + txLog.debug("** END save entity list: user="+user+" list="+list); + logger.debug("[U=" + user + "] SaveEntityList - execution time[ms]: " + (System.currentTimeMillis() - start)); } private Entity removeEmptyAttributes(Entity ent){ diff -r 23c043a19134 -r fd98c31371cb src/main/java/org/mpi/openmind/repository/bo/Entity.java --- a/src/main/java/org/mpi/openmind/repository/bo/Entity.java Thu Oct 20 14:04:36 2016 +0200 +++ b/src/main/java/org/mpi/openmind/repository/bo/Entity.java Thu Oct 20 14:06:10 2016 +0200 @@ -1014,7 +1014,7 @@ String rowIdString = (this.getRowId() == null) ? "" : "rowId=" + this.getRowId() + ", "; String idString = (this.getId() == null) ? "" : "id=" + getId() + ", "; - return "Entity[" + rowIdString + idString + "objClass=" + this.getObjectClass() + ", ownValue=" + this.getOwnValue() + "]"; + return "Entity[" + rowIdString + idString + "objClass=" + this.getObjectClass() + "]"; } @Override @@ -1046,7 +1046,8 @@ + "system-status=\"" + this.getSystemStatus() + "\", " + "status=\"" + this.getStatus() + "\", " + "type=\"" + this.getType() + "\", " - + "b64-value=\"" + ((this.getOwnValue() != null) ? Base64.encodeBase64String(this.getOwnValue().getBytes("UTF-8")) : "") + "\"]"; + + "b64-value=\"" + ((this.getOwnValue() != null) ? Base64.encodeBase64String(this.getOwnValue().getBytes("UTF-8")) : "") + + "\"]"; return es; } catch (UnsupportedEncodingException e) { // this shouldn't happen