]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/RelationInfoQuery.java
Still working for multiple readers
[simantics/platform.git] / bundles / org.simantics.db.impl / src / org / simantics / db / impl / query / RelationInfoQuery.java
index 667d2f1256917551ecff8bc0f68ff6501528cccb..204a0005af1178a19efc6bc2edee8f9ea3747f07 100644 (file)
@@ -41,6 +41,7 @@ final public class RelationInfoQuery extends UnaryQuery<InternalProcedure<Relati
                        
                        @Override
                        public void execute(ReadGraphImpl graph, int i) throws DatabaseException {
+                               if(done) return;
                                done = true;
                                RelationInfo result = new RelationInfo(r, isFunctional, isFinal, true);
                                if(entry != null) entry.setResult(result);
@@ -49,22 +50,20 @@ final public class RelationInfoQuery extends UnaryQuery<InternalProcedure<Relati
 
                        @Override
                        public void finished(ReadGraphImpl graph) throws DatabaseException {
-                               if(!done) {
-                                       done = true;
-                                       RelationInfo result = new RelationInfo(r, isFunctional, isFinal, false);
-                                       if(entry != null) entry.setResult(result);
-                                       proc.execute(graph, result);
-                               }
+                               if(done) return;
+                               done = true;
+                               RelationInfo result = new RelationInfo(r, isFunctional, isFinal, false);
+                               if(entry != null) entry.setResult(result);
+                               proc.execute(graph, result);
                        }
 
                        @Override
                        public void exception(ReadGraphImpl graph, Throwable throwable) throws DatabaseException {
-                               if(!done) {
-                                       done = true;
-                                       DatabaseException e = new DatabaseException("Internal error in RelationInfoQuery");
-                                       if(entry != null) entry.except(e);
-                                       proc.exception(graph, e);
-                               }
+                               if(done) return;
+                               done = true;
+                               DatabaseException e = new DatabaseException("Internal error in RelationInfoQuery");
+                               if(entry != null) entry.except(e);
+                               proc.exception(graph, e);
                        }
                        
                });
@@ -78,14 +77,14 @@ final public class RelationInfoQuery extends UnaryQuery<InternalProcedure<Relati
            final int superRelationOf = provider.getSuperrelationOf();
         assert(superRelationOf != 0);
         
-        IntSet direct = QueryCache.resultDirectPredicates(graph, r, entry, null, QueryCache.emptyProcedureDirectPredicates);
-        IntSet types = QueryCache.resultTypes(graph, r, entry, null, QueryCache.emptyProcedureTypes);
+        IntSet direct = QueryCache.resultDirectPredicates(graph, r, entry, null);
+        IntSet types = QueryCache.resultTypes(graph, r, entry, null);
         
        computeAssertions(graph, r, !direct.contains(superRelationOf), types.contains(graph.processor.getFunctionalRelation()), entry, procedure);
         
        }
 
-       @Override
+       //@Override
        public Object compute(ReadGraphImpl graph, final InternalProcedure<RelationInfo> procedure) throws DatabaseException {
                computeForEach(graph, id, this, procedure);
                return getResult();