]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/ClusterTable.java
Merge branch 'private/db-threads' into private/threads-testing
[simantics/platform.git] / bundles / org.simantics.db.procore / src / fi / vtt / simantics / procore / internal / ClusterTable.java
index 5daf534fef481ca3e6b3bd43dcf637d82e2bb4ef..fe14529845a12710979de8a0c30d82cd36167cd7 100644 (file)
@@ -297,9 +297,7 @@ public final class ClusterTable implements IClusterTable {
         if (existing.hasVirtual())
             cluster.markVirtual();
 
-        long existingImportance = existing.getImportance();
-        if (existingImportance != 0)
-            importanceMap.remove(existingImportance);
+        importanceMap.remove(existing.getImportance());
         if (collectorPolicy != null)
             collectorPolicy.removed((ClusterImpl)existing);
 
@@ -888,7 +886,7 @@ public final class ClusterTable implements IClusterTable {
     }
     
     @SuppressWarnings("unchecked")
-    public final <T extends ClusterI> T getClusterByResourceKey(final int resourceKey) {
+    public synchronized final <T extends ClusterI> T getClusterByResourceKey(final int resourceKey) {
         int clusterKey = ClusterTraitsBase.getClusterKeyFromResourceKeyNoThrow(resourceKey);
         if (ClusterTraitsBase.isVirtualClusterKey(clusterKey))
             throw new RuntimeException("Tried to get a persistent cluster for a virtual resource.");
@@ -1207,8 +1205,8 @@ public final class ClusterTable implements IClusterTable {
         int ims = importanceMap.size();
         int ihms = countImportantClusters();
 
-//        System.out.format("[%s] Validating ClusterTable: byteSize=%d, hashMap=%d/%d, importanceMap=%d%n",
-//                place, sizeInBytes, ihms, clusters.hashMap.size(), ims);
+//        System.out.format("[ClusterTable.%s] Validating: byteSize=%d (%d MB), hashMap=%d/%d, importanceMap=%d%n",
+//                place, sizeInBytes, sizeInBytes / (1024*1024), ihms, clusters.hashMap.size(), ims);
 
         int i = clusterArray.length;
         long size = 0;