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;
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)
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);
this.close(); // Everything is lost anyway.
throw new IllegalStateException(e);
} finally {
+ Disposable.safeDispose(cs);
lock.unlock();
}
}