]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.structural2/src/org/simantics/structural2/queries/ConnectionPointMapOfResource.java
Multiple readers and variable optimization
[simantics/platform.git] / bundles / org.simantics.structural2 / src / org / simantics / structural2 / queries / ConnectionPointMapOfResource.java
index 3b2e42ae77f184f9e77bd141a9eef634eb495a9f..d7ba2901bc09bfe814b1fbace9a3ff91b8803908 100644 (file)
@@ -28,7 +28,7 @@ import org.slf4j.LoggerFactory;
 
 import gnu.trove.map.hash.THashMap;
 
-public class ConnectionPointMapOfResource extends TransientResourceRead<Map<String, Resource>> {
+public class ConnectionPointMapOfResource extends TransientResourceRead<Map<String, PropertyInfo>> {
 
     private static final Logger LOGGER = LoggerFactory.getLogger(ConnectionPointMapOfResource.class);
 
@@ -41,18 +41,18 @@ public class ConnectionPointMapOfResource extends TransientResourceRead<Map<Stri
        }
 
        @Override
-       public Map<String,Resource> perform(ReadGraph graph, Resource resource) throws DatabaseException {
+       public Map<String,PropertyInfo> perform(ReadGraph graph, Resource resource) throws DatabaseException {
            
                Collection<Resource> predicates = graph.getPredicates(resource);
                
-               THashMap<String,Resource> result = null;
+               THashMap<String,PropertyInfo> result = null;
                
                for(Resource predicate : predicates) {
                        
                        PropertyInfo info = graph.syncRequest(new PossibleConnectionPointInfo(predicate), TransientCacheAsyncListener.<PropertyInfo>instance());
                        if(info != null) {
-                               if (result == null) result = new THashMap<String,Resource>(predicates.size());
-                               if (result.put(info.name, predicate) != null)
+                               if (result == null) result = new THashMap<String,PropertyInfo>(predicates.size());
+                               if (result.put(info.name, info) != null)
                                    LOGGER.error("The database contains siblings with the same name " + info.name + " (resource=$" + resource.getResourceId() + ").");
                        }