]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/CacheEntry.java
Fixed multiple issues causing dangling references to discarded queries
[simantics/platform.git] / bundles / org.simantics.db.impl / src / org / simantics / db / impl / query / CacheEntry.java
index d65622dadd0a18ecafb1c15b3c7c22b15b345cb0..a650f32ce8dc6ee1f70166cbb3e21c31b6604f17 100644 (file)
  *******************************************************************************/
 package org.simantics.db.impl.query;
 
+import java.util.Collection;
+
 import org.simantics.db.exception.DatabaseException;
 import org.simantics.db.impl.graph.ReadGraphImpl;
 
 
 
-public abstract class CacheEntry {
+public abstract class CacheEntry<Procedure> {
        
     final public static int HAS_BEEN_BOUND = 1;
 
@@ -29,28 +31,30 @@ public abstract class CacheEntry {
 
     abstract void setReady();
     abstract void refute();
-    abstract void setPending();
+    abstract void setPending(QuerySupport querySupport);
     abstract void discard();
     abstract void except(Throwable t);
-    abstract void setResult(Object result);
     abstract void clearResult(QuerySupport support);
 
     abstract void prepareRecompute(QuerySupport querySupport);
     
     abstract public Object getOriginalRequest();
     abstract Query getQuery();
-    abstract <T> T getResult();
 
     abstract CacheEntry pruneFirstParents();
+    abstract void pruneParentSet();
     abstract void removeParent(CacheEntry entry);
     abstract void addParent(CacheEntry entry);
     abstract boolean hasParents();
-    abstract Iterable<CacheEntry> getParents(QueryProcessor processor);
+    abstract Collection<CacheEntry<?>> getParents(QueryProcessor processor);
     abstract CacheEntry getFirstParent(QueryProcessor processor);
     abstract boolean moreThanOneParent(QueryProcessor processor);
     abstract int parentCount(QueryProcessor processor);
     
-    abstract void performFromCache(ReadGraphImpl graph, Object provider, Object procedure);
+    abstract <T> T getResult();
+    abstract void setResult(Object result);
+    
+    abstract Object performFromCache(ReadGraphImpl graph, Procedure procedure) throws DatabaseException;
     
     abstract boolean isImmutable(ReadGraphImpl graph) throws DatabaseException;