]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/SessionImplSocket.java
Merge "Better emptying of trash bin"
[simantics/platform.git] / bundles / org.simantics.db.procore / src / fi / vtt / simantics / procore / internal / SessionImplSocket.java
index 9a86dc1fa2ae813b0b3a137b51a9063546af27af..d71a8bfc81c491d52dc7afe30cae65a5e8e95d60 100644 (file)
@@ -34,6 +34,7 @@ import org.simantics.databoard.Bindings;
 import org.simantics.db.AsyncReadGraph;
 import org.simantics.db.ChangeSet;
 import org.simantics.db.DevelopmentKeys;
+import org.simantics.db.Disposable;
 import org.simantics.db.ExternalValueSupport;
 import org.simantics.db.Metadata;
 import org.simantics.db.MonitorContext;
@@ -429,6 +430,7 @@ public abstract class SessionImplSocket implements Session, WriteRequestSchedule
                 try {
 
                     flushCounter = 0;
+                    Disposable.safeDispose(clientChanges);
                     clientChanges = new ClientChangesImpl(SessionImplSocket.this);
 
                     VirtualGraph vg = getProvider(request.getProvider());
@@ -555,6 +557,7 @@ public abstract class SessionImplSocket implements Session, WriteRequestSchedule
                 fireSessionVariableChange(SessionVariables.QUEUED_WRITES);
 
                 flushCounter = 0;
+                Disposable.safeDispose(clientChanges);
                 clientChanges = new ClientChangesImpl(SessionImplSocket.this);
 
                 VirtualGraph vg = getProvider(request.getProvider());
@@ -677,6 +680,7 @@ public abstract class SessionImplSocket implements Session, WriteRequestSchedule
                 fireSessionVariableChange(SessionVariables.QUEUED_WRITES);
 
                 flushCounter = 0;
+                Disposable.safeDispose(clientChanges);
                 clientChanges = new ClientChangesImpl(SessionImplSocket.this);
 
                 acquireWriteOnly();
@@ -1018,15 +1022,13 @@ public abstract class SessionImplSocket implements Session, WriteRequestSchedule
                        try {
 
                                int sResourceKey = ClusterTraits.getResourceIndexFromResourceKey(s);
-                               int pResourceKey = ClusterTraits.getResourceIndexFromResourceKey(p);
-                               int oResourceKey = ClusterTraits.getResourceIndexFromResourceKey(o);
 
                                ClusterI pc = clusterTable.getClusterProxyByResourceKey(p);
                                ClusterI oc = clusterTable.getClusterProxyByResourceKey(o);
 
                                clusterTranslator.addStatementIndex(cluster, sResourceKey, cluster.getClusterUID(), ClusterChange.REMOVE_OPERATION);
-                               clusterTranslator.addStatementIndex(cluster, pResourceKey, pc.getClusterUID(), ClusterStream.NULL_OPERATION);
-                               clusterTranslator.addStatementIndex(cluster, oResourceKey, oc.getClusterUID(), ClusterStream.NULL_OPERATION);
+                               clusterTranslator.addStatementIndex(cluster, p, pc.getClusterUID(), ClusterStream.NULL_OPERATION);
+                               clusterTranslator.addStatementIndex(cluster, o, oc.getClusterUID(), ClusterStream.NULL_OPERATION);
                                clusterTranslator.removeStatement(cluster);
 
                                queryProvider2.invalidateResource(s);
@@ -1296,6 +1298,7 @@ public abstract class SessionImplSocket implements Session, WriteRequestSchedule
             fireSessionVariableChange(SessionVariables.QUEUED_WRITES);
 
             flushCounter = 0;
+            Disposable.safeDispose(clientChanges);
             clientChanges = new ClientChangesImpl(SessionImplSocket.this);
 
             acquireWriteOnly();
@@ -1381,6 +1384,7 @@ public abstract class SessionImplSocket implements Session, WriteRequestSchedule
                         fireSessionVariableChange(SessionVariables.QUEUED_WRITES);
 
                         flushCounter = 0;
+                        Disposable.safeDispose(clientChanges);
                         clientChanges = new ClientChangesImpl(SessionImplSocket.this);
 
                         acquireWriteOnly();