]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/Statements.java
Still working for multiple readers
[simantics/platform.git] / bundles / org.simantics.db.impl / src / org / simantics / db / impl / query / Statements.java
index e1a106aaac540cc019262d03f1688194bbd23fd2..ad4700aa826d6178f9447f81fa8e606ddfd13f0f 100644 (file)
@@ -135,6 +135,10 @@ final public class Statements extends CollectionBinaryQuery<TripleIntProcedure>
        
     final static private void forSingleAssertion(ReadGraphImpl graph, final int r1, final int r2, final Statements entry, final TripleIntProcedure procedure) throws DatabaseException {
         
+       if(entry != null) {
+               assert(entry.isPending());
+       }
+       
        IntArray map = getAssertionMap(graph, r1, r2, entry);
        if(map == null) {
             if(entry != null) entry.finish(graph, procedure);
@@ -647,15 +651,13 @@ final public class Statements extends CollectionBinaryQuery<TripleIntProcedure>
         }
         
     }
-    
-    @Override
-    public Object compute(ReadGraphImpl graph, final TripleIntProcedure procedure) throws DatabaseException {
-       computeForEach(graph, r1(), r2(), this, procedure);
-       return getResult();
-    }
        
     public static void computeForEach(ReadGraphImpl graph, final int r1, final int r2, final Statements entry, final TripleIntProcedure procedure) throws DatabaseException {
        
+       if(entry != null) {
+               assert(entry.isPending());
+       }
+       
        QueryCache.runnerRelationInfoQuery(graph, r2, entry, null, new InternalProcedure<RelationInfo>() {
 
             @Override
@@ -690,6 +692,7 @@ final public class Statements extends CollectionBinaryQuery<TripleIntProcedure>
 
         synchronized(this) {
             setReady();
+            //new Exception(toString() + " is READY").printStackTrace();
         }
 
         IntArray v = (IntArray)getResult();
@@ -761,7 +764,7 @@ final public class Statements extends CollectionBinaryQuery<TripleIntProcedure>
     @Override
     public void recompute(ReadGraphImpl graph) throws DatabaseException {
         
-        compute(graph, new TripleIntProcedureAdapter() {
+        computeForEach(graph, r1(), r2(), this, new TripleIntProcedureAdapter() {
 
             @Override
             public void finished(ReadGraphImpl graph) {