diff src/main/java/org/mpi/openmind/cache/WrapperService.java @ 64:83b209aa4226

working on stale entity update problem.
author casties
date Thu, 26 Jan 2017 19:37:25 +0100
parents 58659e865279
children 74cd973f6ece
line wrap: on
line diff
--- a/src/main/java/org/mpi/openmind/cache/WrapperService.java	Mon Jan 09 20:38:55 2017 +0100
+++ b/src/main/java/org/mpi/openmind/cache/WrapperService.java	Thu Jan 26 19:37:25 2017 +0100
@@ -663,16 +663,19 @@
 		entity = removeEmptyAttributes(entity);
 
 		txLog.debug("** START save entity: user="+user+" entity="+entity.toSmallString());
+		// check if entity is up to date with cache
+		if (!cache.isEntityCurrent(entity)) {
+			logger.error("Entity to save not up to date with cache!");
+		}
+		
 		// 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.debug("[U=" + user + "] SaveEntity - execution time[ms]: " + (System.currentTimeMillis() - start));
 		Entity clone = (Entity) entity.clone();
-		// logger.info(clone.toString());
 		return clone;
 	}
 	
@@ -899,8 +902,7 @@
 				}
 			}
 		}
-		logger.debug("getSourcesForTargetRelation (loading sources) - execution time[ms]: "
-				+ (System.currentTimeMillis() - start));
+		//logger.debug("getSourcesForTargetRelation (loading sources) - execution time[ms]: "+(System.currentTimeMillis() - start));
 		Collections.sort(rs, new EntitySortByNormalizedOwnValue());
 		return rs;
 	}
@@ -996,8 +998,7 @@
 			}
 		}
 		Collections.sort(list, new RelationSortBySourceOW());
-		logger.debug("getTargetRelations - execution time[ms]: "
-				+ (System.currentTimeMillis() - start));
+		//logger.debug("getTargetRelations - execution time[ms]: "+ (System.currentTimeMillis() - start));
 		return list;
 	}
 
@@ -1037,8 +1038,7 @@
 			}
 		}
 		Collections.sort(list, new RelationSortByTargetOW());
-		logger.debug("getSourceRelations - execution time[ms]: "
-				+ (System.currentTimeMillis() - start));
+		//logger.debug("getSourceRelations - execution time[ms]: "+ (System.currentTimeMillis() - start));
 
 		return list;
 	}