]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.db.impl/src/org/simantics/db/impl/BlockingAsyncProcedure.java
Attempt to fix regressions in new code base
[simantics/platform.git] / bundles / org.simantics.db.impl / src / org / simantics / db / impl / BlockingAsyncProcedure.java
index 4ae530317908ce32118b867edaa6c85b52932d0d..ad9f1643829fe506ac57125edaf2bc724a249d05 100644 (file)
@@ -31,7 +31,7 @@ public class BlockingAsyncProcedure<Result> implements AsyncProcedure<Result> {
     public BlockingAsyncProcedure(ReadGraphImpl graph, AsyncProcedure<Result> procedure, Object key) {
         this.procedure = procedure;
         this.key = key;
-        this.graph = ReadGraphImpl.newAsync(graph);
+        this.graph = graph;
         this.graph.asyncBarrier.inc();
     }
 
@@ -58,6 +58,10 @@ public class BlockingAsyncProcedure<Result> implements AsyncProcedure<Result> {
         }
     }
 
+    public void waitBarrier() {
+        graph.asyncBarrier.waitBarrier(key, graph);
+    }
+
     @SuppressWarnings("unchecked")
     public Result get() throws DatabaseException {
 
@@ -72,6 +76,10 @@ public class BlockingAsyncProcedure<Result> implements AsyncProcedure<Result> {
 
     }
 
+    public boolean isDone() {
+        return graph.asyncBarrier.get() == 0;
+    }
+
     @SuppressWarnings("unchecked")
     public Result getResult() {
         return (Result)result;