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%2FSessionRequestManager.java;h=fb421b6105ba1e526f6bfcd883b01b1fe41e4287;hp=a29d6ce045bc619ceae803dfe7bf6d48cb03241a;hb=HEAD;hpb=856c152d1571e7600ce030f856026ce5684b499d diff --git a/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/SessionRequestManager.java b/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/SessionRequestManager.java index a29d6ce04..fb421b610 100644 --- a/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/SessionRequestManager.java +++ b/bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/SessionRequestManager.java @@ -118,10 +118,10 @@ public class SessionRequestManager { public synchronized void startRead(int thread, final SessionRead task) { - session.queryProvider2.scheduleAlways(thread, new SessionTask(task.object, task.thread, task.syncCaller) { + session.queryProvider2.scheduleNow(new SessionTask(null) { @Override - public void run(int thread) { + public void run0(int thread) { try { transactionState.startReadTransaction(thread); task.run(thread); @@ -142,10 +142,10 @@ public class SessionRequestManager { public synchronized void startReadUpdate(int thread) { - session.queryProvider2.scheduleAlways(thread, new SessionTask(null, thread) { + session.queryProvider2.scheduleNow(new SessionTask(null) { @Override - public void run(int thread) { + public void run0(int thread) { session.fireFinishReadTransaction(); @@ -163,10 +163,10 @@ public class SessionRequestManager { public synchronized void startWrite(int thread, final SessionTask task) { - session.queryProvider2.scheduleAlways(thread, new SessionTask((WriteTraits)task.object, task.thread) { + session.queryProvider2.scheduleNow(new SessionTask(null) { @Override - public void run(int thread) { + public void run0(int thread) { try { transactionState.startWriteTransaction(thread); @@ -184,10 +184,10 @@ public class SessionRequestManager { public synchronized void startWriteUpdate(int thread) { - session.queryProvider2.scheduleAlways(thread, new SessionTask(null, thread) { + session.queryProvider2.scheduleNow(new SessionTask(null) { @Override - public void run(int thread) { + public void run0(int thread) { // Support for DelayedWriteRequest cancels during the // read-only part of the request. @@ -216,6 +216,9 @@ public class SessionRequestManager { if(!session.state.isAlive()) return; WriteState writeState = session.writeState; + + assert(writeState != null); + WriteGraphImpl graph = writeState.getGraph(); if(writeState.isExcepted()) { @@ -268,10 +271,10 @@ public class SessionRequestManager { if (!reads.isEmpty()) { final SessionRead read = reads.poll(); - session.queryProvider2.scheduleAlways(thread, new SessionTask(read.object, read.thread, read.syncCaller) { + session.queryProvider2.scheduleNow(new SessionTask(null) { @Override - public void run(int thread) { + public void run0(int thread) { read.run(thread); if(read.notify != null) read.notify.release(); } @@ -296,7 +299,9 @@ public class SessionRequestManager { } else { - throw new IllegalStateException("State in ceased should be WRITE or READ or INIT (was " + state + ")"); + // Spurious wakeup + + //throw new IllegalStateException("State in ceased should be WRITE or READ or INIT (was " + state + ")"); } @@ -307,10 +312,10 @@ public class SessionRequestManager { assert(State.INIT != state); if(State.READ == state) { - session.queryProvider2.schedule(Integer.MIN_VALUE, new SessionTask(task.object, task.thread, task.syncCaller) { + session.queryProvider2.scheduleNow(new SessionTask(null) { @Override - public void run(int thread) { + public void run0(int thread) { try { task.run(thread); } finally { @@ -349,6 +354,8 @@ public class SessionRequestManager { boolean inUpdate = state == State.WRITE_UPDATE; + //System.err.println("schedule write " + task); + assert(State.INIT != state); //task.combine = combine != null ? combine : inUpdate; if(State.IDLE == state) {