]> 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 d55768aaa1a04cea220b146882cdf614e0353fd9..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);
                        }
                        
                });
@@ -85,7 +84,7 @@ final public class RelationInfoQuery extends UnaryQuery<InternalProcedure<Relati
         
        }
 
-       @Override
+       //@Override
        public Object compute(ReadGraphImpl graph, final InternalProcedure<RelationInfo> procedure) throws DatabaseException {
                computeForEach(graph, id, this, procedure);
                return getResult();