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;
import org.simantics.db.impl.internal.RandomAccessValueSupport;
import org.simantics.db.impl.procedure.ResultCallWrappedQueryProcedure4;
import org.simantics.db.impl.procedure.ResultCallWrappedSingleQueryProcedure4;
+import org.simantics.db.impl.query.QueryCache;
+import org.simantics.db.impl.query.QueryCacheBase;
import org.simantics.db.impl.query.QueryProcessor;
import org.simantics.db.impl.query.QueryProcessor.SessionRead;
import org.simantics.db.impl.query.QueryProcessor.SessionTask;
try {
flushCounter = 0;
+ Disposable.safeDispose(clientChanges);
clientChanges = new ClientChangesImpl(SessionImplSocket.this);
VirtualGraph vg = getProvider(request.getProvider());
}
- assert(!queryProvider2.dirty);
+ assert(!queryProvider2.cache.dirty);
} catch (Throwable e) {
fireSessionVariableChange(SessionVariables.QUEUED_WRITES);
flushCounter = 0;
+ Disposable.safeDispose(clientChanges);
clientChanges = new ClientChangesImpl(SessionImplSocket.this);
VirtualGraph vg = getProvider(request.getProvider());
fireSessionVariableChange(SessionVariables.QUEUED_WRITES);
flushCounter = 0;
+ Disposable.safeDispose(clientChanges);
clientChanges = new ClientChangesImpl(SessionImplSocket.this);
acquireWriteOnly();
fireSessionVariableChange(SessionVariables.QUEUED_WRITES);
flushCounter = 0;
+ Disposable.safeDispose(clientChanges);
clientChanges = new ClientChangesImpl(SessionImplSocket.this);
acquireWriteOnly();
fireSessionVariableChange(SessionVariables.QUEUED_WRITES);
flushCounter = 0;
+ Disposable.safeDispose(clientChanges);
clientChanges = new ClientChangesImpl(SessionImplSocket.this);
acquireWriteOnly();
if (listener != null) {
try {
- newGraph.processor.queryRead(newGraph, request, null, new AsyncProcedure<T>() {
+
+ AsyncProcedure ap = new AsyncProcedure<T>() {
@Override
public void exception(AsyncReadGraph graph, Throwable t) {
procedure.execute(graph, t);
}
- }, listener);
+ };
+
+ QueryCache.runnerReadEntry(newGraph, request, null, listener, ap);
+
} catch (Throwable t) {
// This is handled by the AsyncProcedure
//Logger.defaultLogError("Internal error", t);
if (listener != null) {
- newGraph.processor.query(newGraph, request, null, procedure, listener);
-
-// newGraph.waitAsync(request);
+ try {
+ QueryCache.runnerAsyncReadEntry(newGraph, request, null, listener, procedure);
+ //newGraph.processor.query(newGraph, request, null, procedure, listener);
+ } catch (DatabaseException e) {
+ Logger.defaultLogError(e);
+ }
} else {
if (listener != null) {
- newGraph.processor.query(newGraph, request, null, new Procedure<T>() {
-
- @Override
- public void exception(Throwable t) {
- procedure.exception(t);
- if(throwable != null) {
- throwable.set(t);
- }
- }
-
- @Override
- public void execute(T t) {
- if(result != null) result.set(t);
- procedure.execute(t);
- }
-
- }, listener);
+ try {
+ QueryCacheBase.resultExternalReadEntry(newGraph, request, null, listener, procedure);
+ } catch (DatabaseException e) {
+ Logger.defaultLogError(e);
+ }
+
+
+// newGraph.processor.query(newGraph, request, null, new Procedure<T>() {
+//
+// @Override
+// public void exception(Throwable t) {
+// procedure.exception(t);
+// if(throwable != null) {
+// throwable.set(t);
+// }
+// }
+//
+// @Override
+// public void execute(T t) {
+// if(result != null) result.set(t);
+// procedure.execute(t);
+// }
+//
+// }, listener);
// newGraph.waitAsync(request);
public int getAmountOfQueryThreads() {
// This must be a power of two
- return 1;
+ return 4;
// return Integer.highestOneBit(Runtime.getRuntime().availableProcessors());
}