]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.db.common/src/org/simantics/db/common/primitiverequest/RelationInfoRequest.java
Multiple reader thread support for db client
[simantics/platform.git] / bundles / org.simantics.db.common / src / org / simantics / db / common / primitiverequest / RelationInfoRequest.java
index 59a66aeaa7fb8ba7f61e50663c2835c68cb3d4db..5fbe501137a108910f5b375534766644e6ab0079 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************
 /*******************************************************************************
- * Copyright (c) 2007, 2010 Association for Decentralized Information Management
+ * Copyright (c) 2007, 2018 Association for Decentralized Information Management
  * in Industry THTH ry.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * in Industry THTH ry.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
@@ -15,20 +15,24 @@ import org.simantics.db.AsyncReadGraph;
 import org.simantics.db.RelationInfo;
 import org.simantics.db.Resource;
 import org.simantics.db.common.request.ResourceAsyncRead;
 import org.simantics.db.RelationInfo;
 import org.simantics.db.Resource;
 import org.simantics.db.common.request.ResourceAsyncRead;
+import org.simantics.db.exception.DatabaseException;
 import org.simantics.db.procedure.AsyncProcedure;
 import org.simantics.db.service.DirectQuerySupport;
 
 import org.simantics.db.procedure.AsyncProcedure;
 import org.simantics.db.service.DirectQuerySupport;
 
-final public class RelationInfoRequest extends ResourceAsyncRead<RelationInfo> {
+public final class RelationInfoRequest extends ResourceAsyncRead<RelationInfo> {
 
     public RelationInfoRequest(Resource resource) {
         super(resource);
     }
 
 
     public RelationInfoRequest(Resource resource) {
         super(resource);
     }
 
-       @Override
-       public void perform(AsyncReadGraph graph, AsyncProcedure<RelationInfo> procedure) {
-               DirectQuerySupport dqs = graph.getService(DirectQuerySupport.class);
-               dqs.forRelationInfo(graph, resource, procedure);
-       }
-       
-}
-       
\ No newline at end of file
+    @Override
+    public void perform(AsyncReadGraph graph, AsyncProcedure<RelationInfo> procedure) {
+        DirectQuerySupport dqs = graph.getService(DirectQuerySupport.class);
+        try {
+            procedure.execute(graph, dqs.getRelationInfo(graph, resource));
+        } catch (DatabaseException e) {
+            procedure.exception(graph, e);
+        }
+    }
+
+}      
\ No newline at end of file