X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.db.procore%2Fsrc%2Ffi%2Fvtt%2Fsimantics%2Fprocore%2Finternal%2FState.java;h=e0d8eee8a3ddb9d304d6b0109b752e66d0ca46f1;hp=f30418a6a32869bf009fc661baa47244a4679a1b;hb=4aba159170fc72d39c2f930ea224aa71f4cdc2e7;hpb=89509fcdedf40fcfca0144158c28802dea4ab18f diff --git a/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/State.java b/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/State.java index f30418a6a..e0d8eee8a 100644 --- a/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/State.java +++ b/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/State.java @@ -17,6 +17,7 @@ import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; import org.simantics.db.ChangeSet; +import org.simantics.db.Disposable; import org.simantics.db.Operation; import org.simantics.db.VirtualGraph; import org.simantics.db.common.utils.Logger; @@ -286,7 +287,7 @@ class State { try { final boolean undo = false; if (!context.isOk(undo)) // this is a blocking operation - throw new InternalException("Cancel failed. This should never happen. Contact application support."); + throw new InternalException("Cancel failed. This should never happen."); // System.out.println("session cs: " + session.clientChanges); // System.out.println("reverse cs: " + cs); queryProvider.performDirtyUpdates(graph); @@ -296,6 +297,9 @@ class State { } // This will send and accept the reverse change set. transactionToken.cancelEnd(session.writeSupport, null, session.clusterStream); + } else { + queryProvider.performDirtyUpdates(graph); + queryProvider.performScheduledUpdates(graph); } } session.writeSupport.clearMetadata(); @@ -327,17 +331,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); @@ -391,6 +387,7 @@ class State { this.close(); // Everything is lost anyway. throw new IllegalStateException(e); } finally { + Disposable.safeDispose(cs); lock.unlock(); } }