]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.db.procore/src/org/simantics/db/procore/cluster/ClusterSmall.java
Removed contact application support prints
[simantics/platform.git] / bundles / org.simantics.db.procore / src / org / simantics / db / procore / cluster / ClusterSmall.java
index c8309c6bf5303a2909564de1a2f29637a8a34534..b24862a67ba190fbda07166346724a934c2e8d64 100644 (file)
@@ -29,8 +29,8 @@ import org.simantics.db.impl.ForPossibleRelatedValueProcedure;
 import org.simantics.db.impl.Table;
 import org.simantics.db.impl.TableHeader;
 import org.simantics.db.impl.graph.ReadGraphImpl;
-import org.simantics.db.procedure.AsyncContextMultiProcedure;
-import org.simantics.db.procedure.AsyncMultiProcedure;
+import org.simantics.db.procedure.SyncContextMultiProcedure;
+import org.simantics.db.procedure.SyncMultiProcedure;
 import org.simantics.db.service.ClusterUID;
 import org.simantics.db.service.ResourceUID;
 import org.slf4j.Logger;
@@ -272,7 +272,7 @@ final public class ClusterSmall extends ClusterImpl {
         return objectTable.getSingleObject(objectIndex, support, this);
     }
 
-    public void forObjects(ReadGraphImpl graph, int resourceKey, int predicateKey, int objectIndex, AsyncMultiProcedure<Resource> procedure,
+    public void forObjects(ReadGraphImpl graph, int resourceKey, int predicateKey, int objectIndex, SyncMultiProcedure<Resource> procedure,
             ClusterSupport support) throws DatabaseException {
         if (deleted) return;
         if (DEBUG)
@@ -287,7 +287,7 @@ final public class ClusterSmall extends ClusterImpl {
         objectTable.foreachObject(graph, objectIndex, procedure, this);
     }
 
-    public <C> void forObjects(ReadGraphImpl graph, int resourceKey, int predicateKey, int objectIndex, C context, AsyncContextMultiProcedure<C, Resource> procedure,
+    public <C> void forObjects(ReadGraphImpl graph, int resourceKey, int predicateKey, int objectIndex, C context, SyncContextMultiProcedure<C, Resource> procedure,
             ClusterSupport support) throws DatabaseException {
         if (DEBUG)
             System.out.println("ClusterSmall.forObjects1: rk=" + resourceKey + " pk=" + predicateKey);
@@ -386,7 +386,7 @@ final public class ClusterSmall extends ClusterImpl {
 
     @Override
     public void forObjects(ReadGraphImpl graph, int resourceKey,
-            int predicateKey, AsyncMultiProcedure<Resource> procedure) throws DatabaseException {
+            int predicateKey, SyncMultiProcedure<Resource> procedure) throws DatabaseException {
         if (deleted) return;
         SessionImplSocket session = (SessionImplSocket)graph.getSession();
         ClusterSupport support = session.clusterTranslator;
@@ -576,7 +576,7 @@ final public class ClusterSmall extends ClusterImpl {
                 support.setStreamOff(false);
             ClusterI cluster2 = cluster.addRelation(sResourceKey, pResourceKey, oResourceKey, support);
             if (cluster != cluster2)
-                throw new DatabaseException("Internal error. Contact application support.");
+                throw new DatabaseException("Internal error, cluster mismatch.");
             return cluster;
         }
 //        check();
@@ -908,8 +908,11 @@ final public class ClusterSmall extends ClusterImpl {
         if (ClusterTraitsSmall.resourceRefIsLocal(resourceRef)) {
             key = clusterBits | resourceRef;
         } else {
-            foreignTable.fillResourceUID(ClusterTraitsSmall.resourceRefGetForeignIndex((short)resourceRef), this);
-            key = ClusterTraitsBase.createResourceKey(clusterSupport.getClusterKeyByClusterUIDOrMake(clusterUID1, clusterUID2), executeIndex);
+            // TODO: not so nice
+            synchronized(this) {
+                foreignTable.fillResourceUID(ClusterTraitsSmall.resourceRefGetForeignIndex((short)resourceRef), this);
+                key = ClusterTraitsBase.createResourceKey(clusterSupport.getClusterKeyByClusterUIDOrMake(clusterUID1, clusterUID2), executeIndex);
+            }
         }
         if (DEBUG)
             System.out.println("ClusterSmall.execute key=" + key);