]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/State.java
DB client state gets corrupted
[simantics/platform.git] / bundles / org.simantics.db.procore / src / fi / vtt / simantics / procore / internal / State.java
index 5adc593001cd19ae305c5fb3e00dfe181b0003e0..70e2cb10dd603122da7737bab85a2ea88bdc631a 100644 (file)
@@ -47,7 +47,7 @@ class State {
     private volatile int readCount = 0; // Must be volatile so we don't have to synchronize getReadCount.
     private volatile int writeCount = 0; // Must be volatile so we don't have to synchronize getWriteCount.
     private Thread            writeOwner       = null;
-    private int               asyncCount       = 1;
+    private volatile int asyncCount = 1; // Must be volatile so we don't have to synchronize getAsyncCount.
     private TransactionToken  transactionToken = null;
     void setCombine(boolean a) {
         if (null != transactionToken)
@@ -327,17 +327,9 @@ class State {
                 if (vg != null && clusterStream.isDirty())
                     new Exception("Internal error: virtual transaction committed changes into core (" + request + ")").printStackTrace();
 
-//                long start = System.nanoTime();
-                if (null == vg) {
-                    clusterStream.reallyFlush();
-                    // This was fired just before in handleUpdatesAndMetadata
-//                    if (!writeOnly)
-//                        session.fireMetadataListeners(graph, cs);
-                } else
-                    clusterStream.clear();
-
-//                long duration = System.nanoTime() - start;
-//                System.out.println("reallyFlush " + 1e-9*duration + "s. ");
+                // This is needed even when the write targets a virtual graph -
+                // deny can always remove a persistent statement. 
+                clusterStream.reallyFlush();
 
                 session.clientChanges = new ClientChangesImpl(session);