]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/SessionImplSocket.java
Wrong graph was used when performing async query from session
[simantics/platform.git] / bundles / org.simantics.db.procore / src / fi / vtt / simantics / procore / internal / SessionImplSocket.java
index 030d512eb736e2f6303f0d68c1d0b0e3d2e57b97..22d0f316545762d4937b384bea9fd648e8bdd441 100644 (file)
@@ -1632,37 +1632,31 @@ public abstract class SessionImplSocket implements Session, WriteRequestSchedule
                     if (listener != null) {
 
                         try {
-                               QueryCacheBase.resultAsyncReadEntry(newGraph, request, null, listener, procedure);
-                                               } catch (DatabaseException e) {
-                                                       Logger.defaultLogError(e);
-                                               }
+                            QueryCacheBase.resultAsyncReadEntry(newGraph, request, null, listener, procedure);
+                        } catch (DatabaseException e) {
+                            LOGGER.error("Unhandled query exception", e);
+                        }
 
                     } else {
 
-                       BlockingAsyncProcedure<T> wrap = new BlockingAsyncProcedure<T>(newGraph, null, procedure, request, true) {
-                               
-                               public void execute(AsyncReadGraph graph_, T result) {
-                                       task.finish();
-                                       super.execute(graph_, result);
-                               }
-                               
-                               public void exception(AsyncReadGraph graph_, Throwable t) {
-                                       task.finish();
-                                       super.exception(graph_, t);
-                               }
-                               
-                       };
-
-                       try {
+                        BlockingAsyncProcedure<T> wrap = new BlockingAsyncProcedure<T>(newGraph, null, procedure, request, true) {
 
-                            request.perform(newGraph, wrap);
-                            wrap.dec();
-                            wrap.get();
+                            public void execute(AsyncReadGraph graph_, T result) {
+                                task.finish();
+                                super.execute(graph_, result);
+                            }
 
-                        } catch (DatabaseException e) {
+                            public void exception(AsyncReadGraph graph_, Throwable t) {
+                                task.finish();
+                                super.exception(graph_, t);
+                            }
 
-                                                       Logger.defaultLogError(e);
+                        };
 
+                        try {
+                            wrap.performSync(request);
+                        } catch (DatabaseException e) {
+                            LOGGER.error("Unhandled query exception", e);
                         }
 
                     }