line(content, " " + clazz + " entry = (" + clazz + ")cache.getOrCreate" + clazz + "(graph, " + signature.keyName + ");");
}
line(content, " " + signature.procedure + " procedure_ = procedure != null ? procedure : emptyProcedure" + clazz + ";");
- line(content, " ListenerEntry listenerEntry = cache.registerDependencies(graph, entry, parent, listener, procedure_, false);");
- line(content, " if(entry.isReady()) " + (genReturn ? "return " : "") + "entry.performFromCache(graph, procedure_);");
+ line(content, " if(entry.isReady()) {");
+ line(content, " graph.processor.listening.registerDependencies(graph, entry, parent, listener, procedure_, false);");
+ if(genReturn) {
+ line(content, " Object result = entry.performFromCache(graph, procedure_);");
+ line(content, " graph.processor.listening.registerFirstKnown(listener, result);");
+ line(content, " return result;");
+ } else {
+ line(content, " entry.performFromCache(graph, procedure_);");
+ }
+ line(content, " }");
line(content, " else {");
line(content, " assert(entry.isPending());");
- if(shortcut) line(content, " " + (genReturn ? "Object result = " : "") + clazz + ".computeForEach(graph, " + signature.keyName + ", entry, procedure_" + (signature.useNeedsToBlock ? ", needsToBlock" : "") + ");");
- else line(content, " entry.compute(graph, procedure_);");
- line(content, " if(listenerEntry != null) cache.primeListenerEntry(listenerEntry, entry.getResult());");
- if(genReturn) line(content, " return result;");
+ if(genReturn) {
+ line(content, " graph.processor.listening.registerDependencies(graph, entry, parent, listener, procedure_, false);");
+ if(shortcut) line(content, " Object result = " + clazz + ".computeForEach(graph, " + signature.keyName + ", entry, procedure_" + (signature.useNeedsToBlock ? ", needsToBlock" : "") + ");");
+ else line(content, " entry.compute(graph, procedure_);");
+ line(content, " graph.processor.listening.registerFirstKnown(listener, result);");
+ line(content, " return result;");
+ } else {
+ line(content, " graph.processor.listening.registerDependencies(graph, entry, parent, listener, procedure_, false);");
+ if(shortcut) line(content, " " + clazz + ".computeForEach(graph, " + signature.keyName + ", entry, procedure_" + (signature.useNeedsToBlock ? ", needsToBlock" : "") + ");");
+ else line(content, " entry.compute(graph, procedure_);");
+ }
line(content, " }");
line(content, "}");
line(content, "");
content.append("public class QueryCache extends QueryCacheBase {\n");
content.append("\n");
- line(content, "private static final boolean SINGLE = false;");
+ line(content, "private static final boolean SINGLE = true;");
content.append("\n");
line(content,"public QueryCache(QuerySupport querySupport, int threads) {");